jett
jett

Reputation: 1274

How to correctly deal with thousands of lines of text in jQuery mobile / Phonegap

Right now I have thousands of lines of text saved in a listview that has about 100 elements. When I select an item from the listview it often takes 500ms >. This delay only occurs on older phones, and I believe it has to do with the large amount of text being inserted into jQuery Mobile's psuedo pages. What can I do to reduce this delay?

Upvotes: 1

Views: 261

Answers (2)

Apostolos Emmanouilidis
Apostolos Emmanouilidis

Reputation: 7197

In my opinion you would accomplish better performance results by using a lazy loading strategy.

What is Lazy loading?

Lazy loading is a pattern/strategy used to defer object initialization/loading until the point at which is needed.

How Lazy loading fits your case?

Loading the content as it's needed during a listview scroll, optimizes the performance of a mobile application.

Are there any Lazy loading frameworks for mobile web applications?

Before looking for an existing framework, I would suggest to search for Lazy loading on the web and get your feet wet with the topic. This way will make you understand which solution across a variety of Lazy loading implementations fits your needs. On the other side if you want an existing solution, you could give a try to jquery.mobile.lazyloader which is a jQuery Mobile Widget for lazy loading listviews with AJAX calls to a server-side resource. It is a way to optimize the performance of mobile applications that contain a list of 50 or more items. Note that it contains only the client-side part of the lazyloading solution. It is left on the developer to implement the server side part that should return JSON formatted data.

I hope this helps.

Upvotes: 1

jay
jay

Reputation: 9

Render only the visible elements like what slickgrid does using a viewport or use paging or ellipsis if the number of elements is too much

Upvotes: 0

Related Questions