使用 JQgrid 实时加载数据

发布于 2024-12-23 10:57:18 字数 160 浏览 2 评论 0原文

我有一个系统,它使用 JQgrid 通过 XML 加载大量数据。 真正的性能问题是,每一行都在 php 上处理了很长时间(计算获取和各种 php 优点..),所以我想知道是否有可能使每个处理的行实时 - 这意味着总数量网格负载是相同的,但用户体验更好,因为他会看到网格慢慢填满。

这可能吗?

I have a system that is using the JQgrid to load large amount of data via XML.
the real performance issue is that every row is been processed on the php for a long time (calculation fetching and all kinds of php goodness ..) so i was wondering if its possible to get each processed row LIVE - meaning that the total amount of grid load is the same but the user experience is better since he will see the grid slowly fill out..

Is that possible at all ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薄暮涼年 2024-12-30 10:57:18

我将通过更改网格加载方法来完成此任务。我不会使用简单的方法来获取数据(通过 url: 'myXMLData.php' 参数在网格中直接访问数据),而是通过调用 addXmlData

基本上,该过程是使用空值初始化网格,然后启动对服务器的请求以开始构建响应。该请求将立即返回,并传回对将随着时间的推移而建立的 XML 位置的引用。此外,这个初始请求将在服务器上分叉一个后台任务,该任务实际上会对临时缓存位置进行处理和 XML 构造(在作为引用返回的同一位置中进行构建)。在浏览器端,该引用被保存,并定期轮询以检查新的 XML 数据(使用 jQuery Ajax 方法)。从每个轮询中获得响应后,使用我上面链接的 addXmlData() 方法来加载包含当前数据集的 jqGrid。当服务器的响应包含您期望的所有行时,轮询可以停止。您还需要在服务器上定期运行一个任务来清理 XML 缓存。

I would accomplish this by changing your grid loading method. Rather than use the simple means of fetching the data (by directly accessing it within the grid via the url: 'myXMLData.php' parameter), I would instead manually populate the grid with a call to addXmlData.

Basically, the process would be to initialize your grid with empty values, and then to kick off a request to the server to start building your response. This request would return immediately, passing back a reference to the XML location that will be built-up over time. Also, this initial request will fork a background task on the server which will actually do the processing and XML construction to a temporary cache location (building it up in that same location that was returned as a reference). On the browser side, that reference is saved, and periodically polled to check for new XML data (using jQuery Ajax methods). After getting the response from each of these polls, use the addXmlData() method I linked above to load the jqGrid with the current set of data. The polling can stop when the response from the server contains all the rows you expect. You will also want a task on the server that runs periodically to clean up the XML cache.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文