update filter programatically using html attributes
update filter programatically using html attributes
I can't seem to figure out how to do this. Sorry if I'm being dense and the answer is right there in front of me.
Prior to implementing datatables on a particular grid, I would hide (or show) groups of rows with a jquery selector based on some element criteria (like a particular class, a data- element etc.) in response to a click event. Obviously, datatables knows nothing about that so while the rows are hidden the total record count etc. doesn't get updated.
What I would like to do is hide the rows with a call to datatables filtering functionality instead. This is what I can't figure out how to do.
There is a small example here to show what I'm doing now. If you click the "hide" button all rows with data-category="edinburgh" will be hidden. If someone could tell me how to do the same thing (first hide, then "unhide") with datatables api it would be much appreciated.
http://live.datatables.net/lexijova/1/
Regards,
Joel
Answers
To programmatically do this through datatables front-end, I believe you would have to implement a version of this blog post that allan made.
Personally, I would do it on the back-end if you are using server-side data since you can easily just modify the query based on any sort of filter you want to make. If not, I think you will need to figure out how to implement the link above.