Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用ASP.NET MVC更新jquery dataTables插件时出现问题_Jquery_Jquery Plugins_Datatables - Fatal编程技术网

使用ASP.NET MVC更新jquery dataTables插件时出现问题

使用ASP.NET MVC更新jquery dataTables插件时出现问题,jquery,jquery-plugins,datatables,Jquery,Jquery Plugins,Datatables,我需要关于更新jQuery数据表插件呈现的表的帮助 我有一个名为Index.aspx的视图,其中有一个DIV,其中呈现了传统的表数据。比如: <div id="students"> <table ...> <thead> ... </thead> <tbody> ... (all the rows are statically re

我需要关于更新jQuery数据表插件呈现的表的帮助

我有一个名为Index.aspx的视图,其中有一个DIV,其中呈现了传统的表数据。比如:

<div id="students">
    <table ...>
         <thead>
           ...
         </thead>
         <tbody>
           ... (all the rows are statically rendered to DOM)
         </tbody>
    </table>

</div>
我设计用于CRUD操作的方法如下:

所有插入、更新和删除场景都调用操作,该操作返回更新DIV的部分视图

然而,即使我看到数据被正确更新,我也会丢失dataTable的功能,如分页、排序等。它甚至不能反映dataTable中记录的正确数量

我理解这是因为dataTable在其内部结构中缓存数据,所以当我使用Ajax更新页面部分时,dataTable不知道数据更改

有人遇到过这种情况吗?解决这个问题的好方法是什么

干杯


大多数情况下,您是否尝试过在ajax之后调用?

在需要刷新表的代码中尝试类似的操作:

oCache.iCacheLower = -1;
oTable.fnDraw();
oCache.iCacheLower = -1;
oTable.fnDraw();