2

We are going to display a list of 25-entries on a webpage out of (at least) 5000 entries in the database. The entries should be sortable and you should be able to filter the results according to their names.

In my world, you send a request to the server asking for 25 entries that matches your criterion. However my colleague suggested a different approach; to ask for all 5000 entries and then sort and filter them with JavaScript.

I think that's stupid, but I'm afraid I'm missing something. What would you say are the pros and cons of this two approaches?

4

1 回答 1

-1

或者使用 AJAX,返回 HTML,进行下一个/上一个分页。这可以给你一个很好的解决方案。

然后你就没有白屏了,UI 看起来更流畅和响应更灵敏,你可以编写一个漂亮(干净和简单)的服务器处理程序,你的同事可以很高兴编写一些 JQuery 和 AJAX。

它使应用程序保持可扩展性,可扩展到任意数量的行,并且 UI 更加流畅和响应迅速。这也许是 JS 想法的重点。

于 2013-05-16T12:15:26.890 回答