简体   繁体   English

来自javascript的数据表服务器端分页修改

[英]Datatable server side pagination modification from javascript

My count query is taking long time to execute. 我的计数查询需要很长时间才能执行。 There is no option to optimize count query. 没有优化计数查询的选项。 Now I want to do something like the picture 现在我想做类似图片的事情 行计数器

I tried with different way to modify the pagination. 我尝试以其他方式修改分页。 But could not get any success yet. 但是还没有成功。

My workflow will be : 我的工作流程将是:

  1. Search and take 10 results and show it 搜索并获取10条结果并显示
  2. initiate count query in a separate http ajax request 在单独的http ajax请求中启动计数查询
  3. when count query finish, initiate pagination of the table 计数查询完成后,启动表分页

Is there any option to do this in datatable? 数据表中是否可以执行此操作?

What I can suggest is, 我可以建议的是

  • Show the table after count query was execute. 执行计数查询后显示表。
  • Better to send count in response headers, So the count query will be reduced. 最好在响应头中发送计数,因此将减少计数查询。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM