Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- doEnsureBufferZone: function() {
- var me = this,
- list = me.cmp,
- store = list.getStore(),
- scroller = list.getScrollable(),
- count = store && store.getCount(),
- bufferZone = me.getBufferZone(),
- item, box, y, index;
- if (!store || !count || !scroller || me.getLoading()) {
- return;
- }
- index = Math.min(Math.max(0, count - bufferZone), count - 1);
- item = list.mapToItem(store.getAt(index));
- // OLD code
- // box = item && item.element.getBox();
- // NEW code starts
- if (item.element) {
- box = item && item.element.getBox();
- } else {
- if (item.el) {
- box = item && item.el.getBox();
- } else {
- return;
- }
- }
- // NEW Code ends
- if (!box) {
- return;
- }
- // if bufferZone is 0, loading the next page should happen when reaching the end
- // of the list (the bottom of the last item), else, if bufferZone is greater than
- // 0, loading the next page should happen when the first row of pixels of the
- // leading buffer zone item appears in the view.
- y = bufferZone > 0 ? box.top + 1 : box.bottom;
- if (y > scroller.getElement().getBox().bottom) {
- return;
- }
- me.loadNextPage();
- },
- 24 Jan 2018, 9:23 AM #2
- elkentzo yaxidaxilstawskitheposeidon
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement