Datatables | fnreloadajax () is not working properly

I am trying to reload data from a new ajax source.

i means that when the page loads, it loads from one source, but after some actions on the page, it needs to be downloaded from another source.

I try to execute it through fnreloadajax() , but it does not work, I mean all fnreload ajax, it reloads the table, but not from a new source

I read the docs for fnreloadajax() http://www.datatables.net/plug-ins/api/fnReloadAjax

but when I tried like this.

  var GroupID = e.val; url = "admin/usersManagePermissions/listFormsInGroups_DT/"+GroupID; oTable.fnReloadAjax(url); 

I did not get any errors, but also datatables do not reload the table from a new source. it only loads the table from the previous / original source that was defined to it.

what's wrong here?

+1
javascript jquery ajax datatables
source share
1 answer

I had the same problem today, here is my solution:

This is a datatable objet, be careful, DataTable ()! = DataTable () see this answer .

 var tableRestr = $('#myDataTable').DataTable({ ajax: someUrl}); 

Then, whenever I need to reload from a different URL, just use two lines:

 tableRestr.ajax.url(newUrl); tableRestr.ajax.reload(); 
0
source share

All Articles