应该在客户端还是在服务器上进行数据排序? [英] Should data sorting be done on the client or on the server?
本文介绍了应该在客户端还是在服务器上进行数据排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从服务器获取数据,并希望在客户端上使用GWT显示数据.
I get data from a server and want to display it using GWT on the client.
这里不是GWT的问题,您可以用Ajax调用替换GWT,也可以将其转换为真实的应用程序而不是Web应用程序.
GWT is not the problem here, you can replace GWT by Ajax calls or you can transpose it to a real application instead of a web app.
在接收数据之后再显示它们之前,应该使用JavaScript在服务器上还是在客户端上进行排序?
Should the sorting be done on the server or on the client using JavaScript after receiving the data and before displaying them?
推荐答案
每种方法都有其优缺点:
Each approach has its pros and cons:
- 如果您需要分页,并且不想将整个数据下载到客户端,则必须在服务器上执行排序(否则客户端只能对它当前具有的行进行排序,这将导致错误的结果,如果您按其他列重新排序)
- 在服务器上排序速度更快(例如:您可以对更多行/秒进行排序),但是如果您必须一次服务10000个客户端,则这很容易反转.
- 在客户端上排序时,您可以重新排序而无需再次下载数据.
这篇关于应该在客户端还是在服务器上进行数据排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文