DataTables:首先绘制表格,然后用服务器端调用的数据填充它
有没有办法先绘制表格,例如将长度设置为 10 行?
我想先绘制表格,高度为 10 行,这应该非常快,然后从服务器端调用填充数据。在jquery插件jqGrid中,它就是这样做的。当它处理ajax调用时,它会显示一条消息“正在加载”。
Is there a way to draw the table first, for example where the length will be set at 10 rows?
I want to draw the table first, with a height of 10 rows, which should be very fast, then populate the data from a server side call. In the jquery plug-in jqGrid, it does this. and when it is processing the ajax call, it displays a msg "loading".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不是 100% 肯定你在寻找什么(具体来说,我不知道你所说的“先绘制表格”是什么意思),但 DataTables 有一个延迟加载选项:http://datatables.net/release-datatables/examples/server_side/defer_loading.html 。使用此选项,您的 HTML 表将从 DOM 中读取,并且读取的内容将用作首页(因此您只需创建包含前 10 行的 HTML 表)。然后任何后续请求都由服务器端处理。
I'm not 100% certainly what you are looking for (specifically I don't know what you mean by "draw the table first"), but DataTables has a deferred loading option: http://datatables.net/release-datatables/examples/server_side/defer_loading.html . With this option your HTML table is read from the DOM and what is read is used as the first page (so you just need to create your HTML table with the first 10 rows). Then any subsequent requests are server-side processing.