2012-05-15 80 views
12

我在我的应用程序中使用了jquery数据表。我的pagination出现问题,我在使用this.table.dataTable().fnDraw()时重置。在fnDraw()上保留分页状态

对于每5秒钟,我的数据表在更新表时调用fnDraw()。当显示this.table.dataTable().fnDraw()时,即使用户在第2页或其他页面上,也会显示第一页。

有没有办法在this.table.dataTable().fnDraw()之后保持分页状态。

回答

18

http://datatables.net/reffnDraw解释说:

Parameter: fnDraw 
Type:  function 
Inputs:  {bool} [default=true]: Re-filter and resort 
      (if enabled) the table before the draw. 

所以,只是尝试this.table.dataTable().fnDraw(false)和它的工作。留在同一页面上,排序也保持不变。

+0

我想你的解决方案,并能够得到关于这一点我是fnDraw之前的页面,但不显示很少的数据的问题(即表中缺少几行)。 – user1181892

+0

你如何检索表格的内容?所有页面加载或你通过服务器处理获取它们? – DKSan

+0

全部在页面加载。 – user1181892