Hi Guys,
I have attached a js.txt file here with this post. The html in that file shows some data in table format. I need to have a filter (drop-down) above the "Status" column which will have two values :
i) show all
ii)only valid status
Upon selecting "show all" it will show all the status "IN", "CO" and "-".
But selecting "only valid status" will discard "-" and will only show "IN" and "CO".
Please notice, I created a "Choose view filter" drop-down just above the table.
I need exactly same drop-down above "Status" column which will work as per
above explanation.
You may ignore that part. I hope you have understood the requirement.
The table structure is clear I guess. I need just a filter above the "Status"
column which is a drop-down and will work as explained before.
I need help on the Javascript code to implement that.
the main headache was caused by rowspans. this script acts the same to the one posted by xelawho, but it uses JQuery framework (see the linked script) and it hides and shows those rowspans.
to get it working you must set attribute id="maintab" for the main table or it will hide and show another table's rows on the page also. it is highly recommended to fix the markup or it may work incorrectly because it's logic is based on it.
from your code, every Command cell sibling to a cell having Status "-" has no links but just text. this was taken as a token.
tested in: Opera, IE, FF, Chrome, Safari
use [code]YOUR CODE GOES HERE[/code] or burn in Hell
Thanks for the solution. It is working perfectly.
But the only problem it is not working in all the versions of
firefox and internet explorer. Only on Firefox 2.0.0.13, it is
working but not on others.
Do I need to change anything to make it work on all any browser
irrespective of its version ?
Hi Padonak,
The solution you sent is working perfectly for that html, but showing some discrepancy in the filtered data for two other htmls. I am attaching the other
two html (in ".txt", please save them in html to check) for which it is partially working.
1. notWorking_1.txt -> There are 11 valid values for "Status" column including 'ER' and 'OK', but only 8 are coming when filtering. Because of the 'rowspan' of the cells under "Task" and "Command" columns
2 notWorking_2.txt -> Same thing and even more interesting. When all the value of "Status" columns are "-" for a particular rowspan , then it is coming.
But in this example one cell is having "IN" for a rowspan and that is not coming.
Please check the "task_template_qualify_dep" row should come but it is not coming.
I consolidated the two htmls for your ease of working. I am attaching that.
For finding the discrepancy you can focus on three consecutive cells under
the "Task" column having value "checkRsf" , "checkRsf1" and "checkRsf2" .
The "Status" filtering for "checkRsf" is working fine. Problem is the other two columns i.e "checkRsf1" and "checkRsf2". I hope you can easily find that for these two columns the rows having "IN" value is not coming while choosing
"onlyValidStatus" in the drop-down above the "Status" column.
Bookmarks