在fnDraw()上保持分页状态 [英] keep pagination state on fnDraw()
问题描述
我在我的应用程序中使用jquery
数据表.我的pagination
有问题,使用this.table.dataTable().fnDraw()
时它正在重置.
I am using jquery
datatables in my application. I have a problem with my pagination
, it is resetting when I use this.table.dataTable().fnDraw()
.
每5秒钟,我的数据表在更新表时都会调用fnDraw()
.调用this.table.dataTable().fnDraw()
时,即使用户在第2页或其他页面上,也会显示第一页.
For every 5 seconds my datatable calls fnDraw()
while updating the table. When this.table.dataTable().fnDraw()
is called first page is displayed, even if the user is on page 2 or other.
是否有一种方法可以保持分页状态,即使在this.table.dataTable().fnDraw()
之后也是如此.
Is there an way to keep the pagination state even after this.table.dataTable().fnDraw()
.
推荐答案
在 http://datatables.net/ref fnDraw
的解释说:
Parameter: fnDraw
Type: function
Inputs: {bool} [default=true]: Re-filter and resort
(if enabled) the table before the draw.
因此,只需尝试this.table.dataTable().fnDraw(false)
即可.停留在同一页面上,排序也保持不变.
So, just tried this.table.dataTable().fnDraw(false)
and it worked. Stayed on the same page and also sorting stayed the same.
这篇关于在fnDraw()上保持分页状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!