Client side advanced filtering

Client side advanced filtering

TheWickermanTheWickerman Posts: 3Questions: 0Answers: 0
edited February 2014 in General
Hello,
I have question similar to this one (https://datatables.net/forums/discussion/comment/57109), however on the client side.

I'm using dataTables to display list of users in administration. I need to filter users by their properties (admin/VIP/banned ...). These properties are saved as bit flags. So I need to check as following:

[code]
function filterCallback(userEntry) {
//Only show administrator users
return userEntry["status"]&USER_ADMIN>0;
}
[/code]
Where USER_ADMIN is some multiple of 2.
How do I do this...? Where do I apply such callback? The [url=https://datatables.net/ref#fnFilter]fnFilter[/url] does not accept functions, only strings.

PS.: I see that in the thread I referred to, user is using markup for links and inline code. However, there is no help on how to use such markup. Why he can use it and I can't?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    For advanced filtering options you need to use custom row based filters: http://datatables.net/development/filtering . That's basically where you apply your callback - fnFilter will have no effect on these filters (since fnFilter uses the built-in filtering) other than to redraw your table. The custom row based filter will apply on every draw.

    Allan
This discussion has been closed.