数据排序应该在客户端还是在服务器上完成? [英] Should data sorting be done on the client or on the server?

查看:15
本文介绍了数据排序应该在客户端还是在服务器上完成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从服务器获取数据并想在客户端使用 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屋!

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