Easy way of programmatically filtering in DataTable
Easy way of programmatically filtering in DataTable
juliandrea85
Posts: 2Questions: 0Answers: 0
Hi,
I've registered at the forum only for share a solution I found, for a problem I had for days about filtering a Datatable from code.
I've tried afnFiltering.push with no success, because I wasn't able to restore the table to their original data.
My code is as below:
var filterCtrl= $("#myDatatable_filter :input"); //locate DOM element input (it will be the input SEARCH field) inside the div "myDatatable_filter"... in both Firefox and IE, the div containing the filter renders this way
filterCtrl.val("my Value to search for"); //value to the input "SEARCH"
filterCtrl.keyup(); //Fire event key up, for the search to work
I hope this help somebody,
Bye!
I've registered at the forum only for share a solution I found, for a problem I had for days about filtering a Datatable from code.
I've tried afnFiltering.push with no success, because I wasn't able to restore the table to their original data.
My code is as below:
var filterCtrl= $("#myDatatable_filter :input"); //locate DOM element input (it will be the input SEARCH field) inside the div "myDatatable_filter"... in both Firefox and IE, the div containing the filter renders this way
filterCtrl.val("my Value to search for"); //value to the input "SEARCH"
filterCtrl.keyup(); //Fire event key up, for the search to work
I hope this help somebody,
Bye!
This discussion has been closed.
Replies
Allan
I've called fnFilter and works fine :-)
Thank you!