datatables | fnreloadajax() is not working properly

匿名 (未验证) 提交于 2019-12-03 10:10:24

问题:

Im trying to reload the datatables from new ajax source.

i mean on page load it loads from 1 source, but after some action on page, it needs to be loaded from another source.

i am trying it through fnreloadajax() but it is not working, i mean all fnreload ajax do, it reloads the table but not from the new source??

i did 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 got no error, but also datatables dont reload the table from new source. it only loads the table from previous/original source which was defined to it.

what is wrong here?

回答1:

I had same problem today, here is my solution:

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

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

Then, always when I need to reload from another url, just use this two lines:

tableRestr.ajax.url(newUrl); tableRestr.ajax.reload(); 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!