在jquery中加载大数据 [英] Loading large data in jquery

查看:109
本文介绍了在jquery中加载大数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个返回数据的Web服务,相当大的一组,可能是600行,20列。
在Jquery代码中将这些数据加载到html表中最快最有效的方法是什么?

I have a web service that returns data, quite a large set, could be 600 rows, by 20 columns. What is the fastest most efficient way to load this data into an html table in Jquery code?

我尝试通过循环返回的数据创建表html并在字符串中创建表DOM,但循环部分非常慢。我听说过Jquery模板,但我不确定这项技术对于大型数据集是否足够快......

I tried creating the table html by looping through the data returned and creating a table DOM inside a string, but the looping part is very slow. I have heard of Jquery Templates, but I am not sure this technology is fast enough for large sets of data....

谢谢

推荐答案

您是否可以更改Web服务或让其他服务调用它并解析数据服务器端并返回HTML?在客户端处理JSON将成为您的瓶颈。如果您可以让服务返回所需的HTML,那么客户端就是一个简单的 element.html(数据)

Is it possible for you to alter the web service or have another service call it and parse the data server side and return HTML? Processing the JSON on the client-side is going to be your bottleneck. If you can have the service return the required HTML to you, then it's a simple element.html(data) on the client side.

编辑:返回JSON或HTML的问题以及各自的优缺点在这里已经讨论过了:
1 2 3 4 5

The question of returning JSON or HTML and the pros and cons of each have been discussed here quite a bit: 1, 2, 3, 4, 5

这篇关于在jquery中加载大数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆