The invention discloses a method for pre loading list, including first pages of data access server module, client module request, query the local database unit server module in response to the request, return to the first page page content to the client; the client server module module receives the data returned to the user through the display list, and cached in the local data cache module in the automatic acquisition server module; second pages of data client modules in the background, the client module receives second pages of data, and cached in the local data cache module. When the user slides down and will slide to the end of the first page data, automatically add second pages of data at the end of the list. When the user slides to second page data, the client module background automatically gets the third page data of the server module. And so on\u3002 This invention can quickly request the server data, quickly display to the user, but also can avoid the problem of memory overflow, and realize the best user experience.
【技术实现步骤摘要】
一种预加载列表的方法
本专利技术涉及计算机软件领域,具体涉及计算机软件中的预加载列表技术。
技术介绍
在软件开发中,经常会遇到需要加载大量数据记录的情况。在这种情况下,有限的屏幕往往很难一次显示完全。那么,通常会采用可以滑动的列表方式来展示数据。但是由于数据量大,一次就从服务器获取全部数据的话,速度可能会很慢,请求失败的概率也会增大。因此,通常又会采用分页加载的方法来填充数据。但是传统的分页加载,只是将大量数据进行简单的分页,比如1000条数据,每页加载50条,页面展示到了当前50条的末尾时,才去加载下面50条,这样的用户体验依然不是很好。而且在移动终端上,不管是一次加载,还是传统的分页加载,如果数据量很大的话,加载到一定数量之后,很容易出现内存溢出。
技术实现思路
针对上述问题,本专利技术实施例提供了一种列表的预加载技术,其核心在于始终在本地缓存3页数据(可以分别命名为PreviousPage、CurrentPage、NextPage),其中CurrentPage的数据用于展现在硬件屏幕上,用户上下滑动的时候,只需动态改变PreviousPage、CurrentPage、NextPage的值就可以了。每一页数据可以是n条,理论上n可以是大于1的自然数,但最好是n条数据能够填充2-3个硬件屏幕。本方法包含客户端模块、服务端模块和本地数据缓存模块。本方法包含以下步骤:一种预加载列表方法,包括如下步骤:步骤一:客户端模块请求访问服务端模块第1页数据,服务端模块响应请求后查询本地数据库单元,返回第1页的分页内容至客户端;步骤二:客户端模块接收服务端模块返回的数据,通 ...
【技术保护点】
一种预加载列表方法,其特征在于:包括如下步骤:步骤一:客户端模块请求访问服务端模块第1页数据,服务端模块响应请求后查询本地数据库单元,返回第1页的分页内容至客户端;步骤二:客户端模块接收服务端模块返回的数据,通过列表展示给用户,并缓存在本地数据缓存模块中;步骤三:客户端模块后台自动获取服务器模块第2页数据,客户端模块接收第2页数据,并缓存在本地数据缓存模块中。此时第1页数据是CurrentPage的数据,第2页数据是NextPage的数据;步骤四:当用户向下滑动,并将要滑动到第1页数据的末尾时,在列表的尾部自动加入第2页数据;步骤五:当用户正式下滑到第2页数据的时候,客户端模块后台再自动获取服务端模块第3页数据。此时第1页数据是PreviousPage的数据,第2页数据是CurrentPage的数据,第3页数据是NextPage的数据;步骤六:如此下去,当用户正式下滑到第3页数据的时候,客户端模块后台再自动获取服务端模块第4页数据。此时第2页数据是PreviousPage的数据,第3页数据是CurrentPage的数据,第4页数据是NextPage的数据;用户的下滑操作按此规律执行。步 ...
【技术特征摘要】
1.一种预加载列表方法,其特征在于:包括如下步骤:步骤一:客户端模块请求访问服务端模块第1页数据,服务端模块响应请求后查询本地数据库单元,返回第1页的分页内容至客户端;步骤二:客户端模块接收服务端模块返回的数据,通过列表展示给用户,并缓存在本地数据缓存模块中;步骤三:客户端模块后台自动获取服务器模块第2页数据,客户端模块接收第2页数据,并缓存在本地数据缓存模块中。此时第1页数据是CurrentPage的数据,第2页数据是NextPage的数据;步骤四:当用户向下滑动,并将要滑动到第1页数据的末尾时,在列表的尾部自动加入第2页数据;步骤五:当用户正式下滑到第2页数据的时候,客户端模块后台再自动获取服务端模块第3页数据。此时第1页数据是PreviousPage的数据,第2页数据是CurrentPage的数据,第3页数据是NextPage的数据;步骤六:如此下去,当用户正式下滑到第3页数据的时候,客户端模块后台再自动获取服务端模块第4页数据。此时第2页数据是PreviousPage的数据,第3页数据是CurrentPage的数据,第4页数据是NextPage的数据;用户的下滑操作按此规律执行。步骤七:此时,如...
【专利技术属性】
技术研发人员:刘玉梅,张洪利,
申请(专利权)人:四川长虹电器股份有限公司,
类型:发明
国别省市:四川,51
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。