How to refer to datatable after creation ?
How to refer to datatable after creation ?
I have a set of dynamically created jquery-ui tabs and each has a datatable that i'd like to load when a tab is selected/clicked.
The datatables are created like $('.account').datatable(....) because they share the same style. They do have a unique id. I have setup the ui click event and that works ok.
How can i refer to an individual table later to call fnReloadAjax( url ) on it ?
The datatables are created like $('.account').datatable(....) because they share the same style. They do have a unique id. I have setup the ui click event and that works ok.
How can i refer to an individual table later to call fnReloadAjax( url ) on it ?
This discussion has been closed.
Replies
Thank you
Steve
This came up just a few days ago actually, so nice and easy for me to link to: http://datatables.net/forums/comments.php?DiscussionID=1207#Item_4 :-)
Hope that helps,
Allan
I added an attribute to the on each of the Tabs and use this to find the tab i need.
[code]
$('#'+ui.panel.id ).attr("tab")
[/code]
in the function i then set the the right tablenumber as shown in the other thread.
[code]
$.fn.dataTableExt.iApiIndex = tab;
oTable.fnReloadAjax('/ajax.php?data=acctlist&id='+id);
[/code]
But the ReloadAjax now complains about oSettings not set, when i add it the source is null, what's up ?
It uses the oset as the datasource insteadof url. When i leave oset out, the correct url is used but into the wrong table.
[code]
$.fn.dataTableExt.iApiIndex = tab;
var oset= oTable.fnSettings();
url = '/ajax.php?data=acctlist&id='+id;
oTable.fnReloadAjax( oset, url, '' );
[/code]
However, I'm not seeing why this would fail for you - which you point out it does. It's possible that there is a bug here - but I don't see it on a scan through the code... I think I'll need to set up a test example, but can't to that at this moment unfortunately. I'll see if I can get back to you soon about this.
Allan
Allan
Allan