How to get a pointer to an existing table
How to get a pointer to an existing table
gerbenvaneck
Posts: 1Questions: 0Answers: 0
I have written a library to make it a little easier to integrate datatables into the CodeIgniter framework, but I now have a little trouble getting a pointer to a single instance of a datatable. I am instantiation the datatables like this (CSS class still from the demo...):
[code]
var controller = jQuery.url.segment(0);
$('.display').dataTable({
"sPaginationType": "full_numbers",
"bServerSide": true,
"sAjaxSource": "/"+controller+"/json_index"
//and them some more irrelevant options
});
[/code]
I now have a jQuery dialog in which I add a new item to the table, and after that, I'd liked to reload the table. For example jQuery UI accordion gives me the option to use it like this:
[code]
.accordion( 'activate' , index )
[/code]
Is there anything possible in datatables for this.
After checking with my manager, I'll see if I can give the CodeIgniter library back to the community.
[code]
var controller = jQuery.url.segment(0);
$('.display').dataTable({
"sPaginationType": "full_numbers",
"bServerSide": true,
"sAjaxSource": "/"+controller+"/json_index"
//and them some more irrelevant options
});
[/code]
I now have a jQuery dialog in which I add a new item to the table, and after that, I'd liked to reload the table. For example jQuery UI accordion gives me the option to use it like this:
[code]
.accordion( 'activate' , index )
[/code]
Is there anything possible in datatables for this.
After checking with my manager, I'll see if I can give the CodeIgniter library back to the community.
This discussion has been closed.
Replies
This is something that is planned for DataTables 1.7 ( http://datatables.net/forums/comments.php?DiscussionID=1486 ) - but at the moment you need to store the object that is returned from the DataTables initialisation in order to be able to access it again. So "var table = $('.display').dataTable({ ... });" or something like that. In the next major release you'll be able to do $('.display').dataTable() to get it back (or something like that!).
Thanks for looking into contributing your code - I'm sure others will find it useful!
Regards,
Allan