Refreshing from another context

Refreshing from another context

jimjim Posts: 2Questions: 0Answers: 0
edited February 2010 in General
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

Replies

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

    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
  • jimjim Posts: 2Questions: 0Answers: 0
    Thank you for your answer Allan, and for GPLing this great piece of software and saving me and many others lots of hours of development, has been a great help on a SaaS project i am working on and if i ever manage to sell this thing i'll make sure to send you your cut.

    Jim
This discussion has been closed.