Refreshing from another context
Refreshing from another context
Hi all, i am trying to refresh the table from inside a .js file, actually from the success callback of a ajax form submit, and the thing is that the table is created in the html file as :
[code]
var dt = $("#dataTable").dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": 'list',
"sPaginationType": "full_numbers",
});
[/code]
so i can't call dr.fnDraw() from inside the .js file because dt does not exist there, so here is the question is there a way to do something like
[code]
$("dataTable").fnDraw()
[/code]
or any other way to call fnDraw() outside the context where the dataTable was created?
I tried searching in the forum and found nothing, hope you guys can help.
Best regards, Jim
[code]
var dt = $("#dataTable").dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": 'list',
"sPaginationType": "full_numbers",
});
[/code]
so i can't call dr.fnDraw() from inside the .js file because dt does not exist there, so here is the question is there a way to do something like
[code]
$("dataTable").fnDraw()
[/code]
or any other way to call fnDraw() outside the context where the dataTable was created?
I tried searching in the forum and found nothing, hope you guys can help.
Best regards, Jim
This discussion has been closed.
Replies
No I'm sorry to say that this is not currently possible. I plan to make it possible with the next release - but haven't had a chance to actually do that development work yet. At the moment you need to retain the object returned from the constructor.
I suppose one option might be to use the settings objects in $.fn.dataTableSettings ( $.fn.dataTableSettings[0].oApi._fnDraw( $.fn.dataTableSettings[0] ) for example _might_ do it - but it's a real work around...
Allan
Jim