Using Search feature !
Using Search feature !
Hello ,
First of all thank you for the amazing datatable ,
2nd ,I have a question regarding special use of the datatable , in my application , how i can use datatable search only without listing all the records , but list only the search result ( filtered records ) !
as example : i would like to see a result of all people named "John" when searching the Data !
how i can achieve that ?!
Regards
H
First of all thank you for the amazing datatable ,
2nd ,I have a question regarding special use of the datatable , in my application , how i can use datatable search only without listing all the records , but list only the search result ( filtered records ) !
as example : i would like to see a result of all people named "John" when searching the Data !
how i can achieve that ?!
Regards
H
This discussion has been closed.
Replies
Did you come across the fnFilter() function in the documentation: http://datatables.net/api#fnFilter ? You can just do something like: oTable.fnFilter( "John" );
Regards,
Allan
I just read it , which is really helpful , however , am wondering more about search ,
as example , i have a table of people , and adding an appointment for one i need to search the record then click on " add appointment " link to add appointment to a specific person ,
am already using Datatable now to listing the people , however , i don't want the table to be displayed unless i am using the search ( filtering ) !
BTW : Thanks for the link , am going through the documentation again .
Best Regards
H
Okay - you don't want anything to display, if there is no filter. Interesting one - I didn't really consider that! You can set an initial search string using the 'oSearch' parameter: http://datatables.net/usage/options#oSearch . But I think if you want to allow the user to input their own search, then you'll need to some custom filtering, i.e. if search.length==0, then return false for all records: http://datatables.net/development/filtering
Allan
Thank You Allan
Best Regards