简体   繁体   English

php jquery datatable加载问题

[英]php jquery datatable load issue

I have the table with 15000 data in it. 我的表中有15000个数据。 While open the page, it fluctuates many times. 打开页面时,它会波动很多次。 ie Its loads the entire data first. 即它首先加载整个数据。 Then only it applies the pagination. 然后只有它应用分页。 I have set the 500 records per page. 我已设置每页500条记录。 But the page load is very bad. 但是页面加载非常糟糕。 Is it possible to load only 500 records first instead of load the entire data. 是否可以先只加载500条记录,而不是加载整个数据。

Please let me know your suggestions. 请让我知道您的建议。 Thanks 谢谢

What you are doing is wrong. 你在做什么错了。 What you have to do is use AJAX for this. 您要做的是为此使用AJAX。 DataTables supports AJAX right out of the box. DataTables开箱即用地支持AJAX。

http://www.datatables.net/examples/data_sources/ajax.html http://www.datatables.net/examples/data_sources/ajax.html

http://www.datatables.net/release-datatables/examples/data_sources/ajax.html http://www.datatables.net/release-datatables/examples/data_sources/ajax.html

1st loads the data you want. 1st加载所需的数据。 Then when then use requests for more data get it through a AJAX request. 然后,当使用更多数据请求时,通过AJAX请求获取它。

Perhaps you should try lazy loading. 也许您应该尝试延迟加载。 To configure it, you should consult this link: http://datatables.net/usage/server-side 要配置它,您应该参考以下链接: http : //datatables.net/usage/server-side

If you use lazy loading, the records get initialized when needed. 如果使用延迟加载,则在需要时会初始化记录。

Hope this helps 希望这可以帮助

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

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