简体   繁体   English

选择(*)替代-使用jQuery数据表插件

[英]Select (*) alternative - using jQuery datatables plugin

I am using jQuery dataTables plugin in a custom phonebook I have created for my organizations phonebook. 我在为组织电话簿创建的自定义电话簿中使用jQuery dataTables插件 The issue that I am having is that since I am using the SELECT * from Table command on a table with some 3000+ rows, dataTables wants to load the entire SQL table before loading and it causes the page to lag terribly. 我遇到的问题是,由于我在具有3000多个行的SELECT * from Table上使用SELECT * from Table命令,因此dataTables要在加载前加载整个SQL表,这会导致页面严重滞后。 Is there a better way to do this? 有一个更好的方法吗? My reason for using dataTables is it has a custom jQuery search option which works beautifully. 我使用dataTables的原因是它有一个自定义的jQuery搜索选项,效果很好。

I have tried using SELECT TOP but it will not return anything but the first hundred or however many specified. 我尝试使用SELECT TOP但是除了前一百个或指定的很多外,它不会返回任何东西。

You can load partial data and use ajax to load more data when the user pages through the result. 用户分页浏览结果时,可以加载部分数据并使用ajax加载更多数据。 Have a look at the example they provide. 看一看他们提供的示例。

https://datatables.net/release-datatables/examples/server_side/pipeline.html https://datatables.net/release-datatables/examples/server_side/pipeline.html

Try AJAX paging, like Vlad says. 像Vlad所说的那样尝试AJAX分页。

Also check out the bDeferRender option (look it up here ). 还要检查bDeferRender选项( 在此处查找)。 If set to true you definitely experience faster page load. 如果设置为true您肯定会体验到更快的页面加载速度。 I dont know if that will be fast enough without server-side paging though. 我不知道如果没有服务器端分页,那是否足够快。 And what about the stress put on the DB? 那对数据库造成的压力又如何呢?

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

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