简体   繁体   English

显示大量数据

[英]Showing large amount of data

What is the general guideline on displaying large volume of data in UI? 在UI中显示大量数据的一般准则是什么?

One approach came to my mind was to load few records initially and then based on user input load subsequent records. 我想到的一种方法是先加载少量记录,然后根据用户输入加载后续记录。

Are there any resources available from where I can learn? 我可以从那里学到什么资源吗? This is developed in Java (Both the back-end and the client). 这是用Java开发的(后端和客户端)。

My guidance: go "JViewPort" and start from there. 我的指导:转到“ JViewPort”并从那里开始。 This class is especially designed for large amounts of data. 此类专门为大量数据而设计。

It provides the abstractions to distinguish between data that can be "viewed" - and data that is not "required" right now. 它提供了抽象以区分可以“查看”的数据-和现在不需要的数据。

Sending only what the client requires is always a good idea. 仅发送客户要求的内容总是一个好主意。

One common idea is to use a DTO - Data Transfer Objects which only contains the data used by the client/viewport - you can convert your real objects to those DTOs both for speed and security. 一种常见的想法是使用DTO-数据传输对象,它仅包含客户端/视口使用的数据-为了速度和安全性,您可以将实际对象转换为那些DTO。

Try to send the most minimal as possible data to the client, consider you might cause massive delays and "slow script popups" on the browser if you send large amount of data. 尝试将尽可能少的数据发送到客户端,如果您发送大量数据,可能会导致浏览器出现大量延迟和“缓慢的脚本弹出窗口”。

A good approach is to paginate the data you want to show. 一个好的方法是对要显示的数据进行分页。 So for example you would show a fixed amount of data and then when user scrolls or clicks a button then it will retrieve from the server the next set of data to display. 因此,例如,您将显示固定数量的数据,然后当用户滚动或单击按钮时,它将从服务器检索要显示的下一组数据。

Pure Java is not written for client side , although there are frameworks such as GWT that will allow you to write Java for the client side, however the client side Java code will be translated to JavaScript during compilation. 纯Java并不是为客户端编写的,尽管有些框架(如GWT)可以让您为客户端编写Java,但是在编译过程中,客户端Java代码将转换为JavaScript。

Finally, paginating approaches should be available to provide best user experiences on professional UI frameworks. 最后,分页方法应可用于在专业UI框架上提供最佳用户体验。

Use Pagination ... 使用分页...

  • Pagination is used for such things as displaying a limited number of results in UI 分页用于在UI中显示有限数量的结果
  • Pagination can be handled client-side or server-side. 分页可以在客户端或服务器端进行处理。 Server-side pagination is more common. 服务器端分页更为常见。 Client-side pagination can be used when there are very few records to be accessed. 当要访问的记录很少时,可以使用客户端分页。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM