afnFiltering - is there any way to filter on attributes of elements rather than their contents?
afnFiltering - is there any way to filter on attributes of elements rather than their contents?
cesinco
Posts: 5Questions: 0Answers: 0
I posted earlier about a problem I was having with afnFiltering not even firing and while I have not been able to solve this when running on server-based code, I was able to get further when running local HTML files. Regardless, I have now run into an issue where my attempts to use afnFiltering only half work. The reason is because rather than trying to filter on the text contained within a cell of the table, I am trying to filter on an attribute (specifically class, which may contain multiple class names). This works while the whole table is displayed but fails after the table has been filtered once. The reason is that iDataIndex parameter cannot be used to iterate through the rows of the table when the table has had some rows removed through filtering because an out-of bounds error will occur (table rows are actually eliminated rather than hidden?) so an iDataIndex that was valid when the table of 10 rows (for example) was first built, will not be valid any longer for row 8,9,10, when the table has been filtered down to 7 rows.
Using the aData parameter doesn't help because that only stores the text of the cells and not attributes on which my filtering works, even though it may still hold all 10 row values.
Any suggestion son how to solve this?
Using the aData parameter doesn't help because that only stores the text of the cells and not attributes on which my filtering works, even though it may still hold all 10 row values.
Any suggestion son how to solve this?
This discussion has been closed.
Replies
What you currently need to do is something like:
[code]
function( oSettings, aData, iDataIndex ) {
var tr = oSettings.aoData[ iDataIndex ].nTr;
...
}
[/code]
From there you have the TR element and you can query it for its child elements. Not obvious and not vey performant, but I am looking at making it easier! :-)
Allan