分页:服务器端还是客户端? [英] Pagination: Server Side or Client Side?

查看:180
本文介绍了分页:服务器端还是客户端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

处理分页最好的是什么?服务器端还是使用javascript动态执行?

What is it best to handle pagination? Server side or doing it dynamically using javascript?

我正在研究一个对ajax很重要并且动态提取数据的项目,所以我一直在努力一个使用dom的javascript分页系统 - 但我开始认为在服务器端处理它会更好。

I'm working on a project which is heavy on the ajax and pulling in data dynamically, so I've been working on a javascript pagination system that uses the dom - but I'm starting to think it would be better to handle it all server side.

每个人的想法是什么?

推荐答案

正确的答案取决于您的优先级和要分页的数据集的大小。

The right answer depends on your priorities and the size of the data set to be paginated.

服务器端分页最适合:


  • 大数据集

  • 更快的初始页面加载

  • 未运行javascript的人的辅助功能

客户端分页最适合:


  • 小数据集

  • 更快后续页面加载

因此,如果您主要是出于美观原因进行分页,那么更有意义处理客户端。如果你要分页以减少初始加载时间,那么服务器端是显而易见的选择。

So if you're paginating for primarily cosmetic reasons, it makes more sense to handle it client side. And if you're paginating to reduce initial load time, server side is the obvious choice.

当然,如果你使用Ajax,客户端在后续页面加载时间方面的优势会减少加载后续页面。

Of course, client side's advantage on subsequent page load times diminishes if you utilize Ajax to load subsequent pages.

这篇关于分页:服务器端还是客户端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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