listItemLoaderProvider

jQuery.caph.ui. listItemLoaderProvider

The list item loader requests the required data from the server before reaching both side of the visible item view of the current list. It calculates item loading count and server request threshold count automatically according to the designated list's item view count per page. And then always maintains internal data cache up to twice times than the loading count. So let you are able to use caph list component with a huge amount of data.

Example

js

 $.caph.ui.listItemLoaderProvider.register('loader1', {
     url: '/someUrl',
     dataType: 'jsonp',
     getTotalCount: function(data, status) {
         return data.totalCount;
     },
     getItems: function(data) {
         return data.items;
     }
 });

 $('#list').caphList({
     itemLoader: 'loader1',
     template: '<div class="item" focusable><%= item.text %></div>'
 });

html

 <body>
     <div id="list"></div>
 </body>

Methods

$$get
register
unregister