Place "Filter" input in existing element
Place "Filter" input in existing element
tyman00
Posts: 4Questions: 0Answers: 0
I may be missing something obvious, but is it possible to place the input box for filtering in an existing element? I was looking at sDom, but it looks like that element is dynamically generated by Javascript. I'd like to add the input to an existing div instead of having it created.
The reason is because I don't have a JSON or data feed for the ajax I am using a standard jQuery Ajax request and replacing a content div with the new data and then re-initializing dataTables. However when the table reloads it pulls focus from the Filter Input because it is being regenerated.
I tried adding a focus to the input as part of the ajax request, but it still creates a minor stutter. Any suggestions or alternatives to my methodology is welcome!
The reason is because I don't have a JSON or data feed for the ajax I am using a standard jQuery Ajax request and replacing a content div with the new data and then re-initializing dataTables. However when the table reloads it pulls focus from the Filter Input because it is being regenerated.
I tried adding a focus to the input as part of the ajax request, but it still creates a minor stutter. Any suggestions or alternatives to my methodology is welcome!
This discussion has been closed.
Replies
http://www.datatables.net/ref#fnDrawCallback
or you could ditch the Filter in the sDom altogether and just write your own with the same functionality (it basically just calls .fnFilter()
http://www.datatables.net/ref#fnFilter
I'll look into using .fnFilter. I'm assuming I would have to watch for changes in my new filter input and then apply the content of the filter input to the .fnFilter functionality. Thanks for the tip!
[code]
$('#yourfilter').keyup( function() {
oTable.fnFilter(this.value);
} );
[/code]
or something like that.