Using an external search box ?
Using an external search box ?
smartnut007
Posts: 1Questions: 0Answers: 0
I want to have a search box outside the datatables table. So, after trying to figure our the datatables api( I am a javascript nube ), I got it working by doing this.
I basically hid the datatables search box and copied the contents of the external search box to the datatables search box.
I am using ajax and server side processing.
[code]
$(function(){
$("#profile_list_filter input").parent().hide();
//The id of my external search box is #search.
$("#search").keyup( function(){
$("#profile_list_filter input").val( $(this).val() );
$("#profile_list_filter input").keyup();
} );
});
[/code]
Is there a better way to do this ? Esp using the datatables apis to be able to
a) add addional parameters to the ajax calls.
b) make datatables reload data based on external event.
I basically hid the datatables search box and copied the contents of the external search box to the datatables search box.
I am using ajax and server side processing.
[code]
$(function(){
$("#profile_list_filter input").parent().hide();
//The id of my external search box is #search.
$("#search").keyup( function(){
$("#profile_list_filter input").val( $(this).val() );
$("#profile_list_filter input").keyup();
} );
});
[/code]
Is there a better way to do this ? Esp using the datatables apis to be able to
a) add addional parameters to the ajax calls.
b) make datatables reload data based on external event.
This discussion has been closed.
Replies
Allan