Sencha Touch List Paging: Store Record Limit

I use Sencha Touch List ( xtype: list ) in my applications, with the listPage plugin. It works like an endless effect spell by setting autopaging: true .

BUT, my question is how to save records in the repository (or lines in the list) only on a certain amount, for example 50 records.

So, when the user scrolls down, it automatically loads the next page, deleting the previous (current) page and when scrolling up, loads the previous page.

The goal is to limit the number of records in the store, because if it is loaded (continuing to scroll down), it gives an error message (tested on the iPad).

That makes sense, I have 40k records on db.

+6
source share
1 answer

Yesterday I worked on something similar, but only with the following functionality.

You can override a method that loads a new page on the fly. It is loadNextPage () and adds store.removeAll () before requesting the next page.

In your list:

 plugins: [ { type: 'listpaging', autoPaging: true, noMoreRecordsText: null, loadMoreText: null, loadNextPage: function() { var me = this; if (!me.storeFullyLoaded()) { me.getList().getStore().removeAll(); me.getList().setMasked(true); me.getList().getStore().nextPage({ addRecords: true }); } } } ] 

It is only for Further . It may be a little more complicated for the previous one , but perhaps it can give an idea. Probably adding another cmp to the top of the list that calls store.previousPage ()

Hope this helps -

+2
source

Source: https://habr.com/ru/post/948918/


All Articles