AJAX returns table can I apply DataTables to it?
AJAX returns table can I apply DataTables to it?
Hi,
I have a ajax call that based on the user input generates 2 HTML tables that are returned inside a DIV. Is there a way to apply DataTables on one of the returned tables? Perhaps there is an easier way of doing this that I'm not yet aware of? I'm very new to DataTables so I apologize if my answer is obvious.
Cheers,
Addison
I have a ajax call that based on the user input generates 2 HTML tables that are returned inside a DIV. Is there a way to apply DataTables on one of the returned tables? Perhaps there is an easier way of doing this that I'm not yet aware of? I'm very new to DataTables so I apologize if my answer is obvious.
Cheers,
Addison
This discussion has been closed.
Replies
$('selector-for-the-table').dataTable();
[/code]
:-). Obviously you would need to use a suitable selector...
Allan
What if I return any number of tables back? All the ones that I want to apply dataTabes to have the same selector value, as I mentioned before they are generated based on what the user selects.
Thanks for your help!
Addison
[code] $('#bookData').dataTable( );[/code]
Allan
I'm sure there is a way to do this, suppose I have an unique id at the end of each selector that might look like:
[code]$('#bookDatalz1w6cDKQk').dataTable( );[/code]
Where the suffix could be any random set characters. Is there a way I can initialise a DataTable for each one without knowing the exact selector value. Something along the lines of a foreach loop perhaps? I've been messing around with it for sometime but haven't gotten anywhere yet.
I really appreciate your help. You have been very patient with my troubles... :-D
Addison