How to get a pointer to an existing table

How to get a pointer to an existing table

gerbenvaneckgerbenvaneck Posts: 1Questions: 0Answers: 0
edited March 2010 in General
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.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi gerbenvaneck,

    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
This discussion has been closed.