Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.47 KB | None | 0 0
  1. Ext.Loader.setConfig({
  2. enabled: true
  3. });
  4.  
  5. Ext.Loader.setPath('Ext.ux', 'ext/ux');
  6. Ext.require(['Ext.ux.ajax.JsonSimlet', 'Ext.ux.ajax.SimManager']);
  7.  
  8.  
  9.  
  10.  
  11. Ext.define('Ext.ux.ajax.JsonSimletWithTotal', {
  12. extend: 'Ext.ux.ajax.DataSimlet',
  13. alias: 'simlet.jsonwithtotal',
  14.  
  15. doGet: function (ctx) {
  16. var me = this,
  17. page = [],
  18. i,
  19. j,
  20. reader = ctx.xhr.options.proxy.reader,
  21. ret = me.callParent(arguments),
  22. response = {};
  23.  
  24. for (i = ctx.params.start, j = 0; i < ctx.params.start + ctx.params.limit; i++ , j++) {
  25. page[j] = {
  26. name: 'User ' + Ext.util.Format.number(i + 1, '0,000')
  27. };
  28. }
  29.  
  30. response[reader.root] = page;
  31. response[reader.totalProperty] = 500000;
  32.  
  33. ret.responseText = Ext.encode(response);
  34. return ret;
  35. }
  36. });
  37.  
  38. Ext.onReady(function () {
  39. Ext.ux.ajax.SimManager.register({
  40. 'remote-data.php': {
  41. stype: 'jsonwithtotal'
  42. }
  43. });
  44.  
  45. Ext.create('Ext.container.Viewport', {
  46. layout: 'fit',
  47. items: [{
  48. xtype: 'grid',
  49. title: '1,000,000 Users',
  50. store: {
  51. autoLoad: true,
  52. buffered: true,
  53. pageSize: 100,
  54. fields: [{
  55. name: 'name'
  56. }],
  57. proxy: {
  58. type: 'ajax',
  59. url: 'remote-data.php',
  60. reader: {
  61. type: 'json',
  62. root: 'data'
  63. }
  64. }
  65. },
  66. selModel: Ext.create('Ext.selection.CheckboxModel', {
  67. }),
  68. columns: [{
  69. xtype: 'rownumberer',
  70. width: 60,
  71. sortable: false
  72. }, {
  73. text: 'Name',
  74. dataIndex: 'name',
  75. width: 300
  76. }],
  77. viewConfig: {
  78. rowHeight: 16,
  79. trackOver: false,
  80. stripeRows: false,
  81. loadMask: true,
  82. preserveScrollOnRefresh: true,
  83. enableTextSelection: true
  84. },
  85. verticalScroller: {
  86. scrollToLoadBuffer: 700,
  87. trailingBufferZone: 10,
  88. leadingBufferZone: 20
  89. },
  90. scrollable: true,
  91. columnLines: true
  92. }]
  93. });
  94. });
  95.  
  96.  
  97. var MAX_EL_HEIGHT = 1500000; // ie height, simulate constrained scroller height
  98. //MAX_EL_HEIGHT = 9500000; // row height that works for chrome, test formulas in chrome
  99.  
  100. //--------------------
  101.  
  102. // Ext.grid.PagingScroller ln: 43001
  103. /**
  104. * This class monitors scrolling of the {@link Ext.view.Table TableView} within a
  105. * {@link Ext.grid.Panel GridPanel} which is using a buffered store to only cache
  106. * and render a small section of a very large dataset.
  107. *
  108. * The GridPanel will instantiate this to perform monitoring, this class should
  109. * never be instantiated by user code.
  110. */
  111. Ext.define('Ext.grid.PagingScroller', {
  112.  
  113. /**
  114. * @cfg
  115. * @deprecated This config is now ignored.
  116. */
  117. percentageFromEdge: 0.35,
  118.  
  119. /**
  120. * @cfg
  121. * The zone which causes a refresh of the rendered viewport. As soon as the edge
  122. * of the rendered grid is this number of rows from the edge of the viewport, the view is moved.
  123. */
  124. numFromEdge: 2,
  125.  
  126. /**
  127. * @cfg
  128. * The number of extra rows to render on the trailing side of scrolling
  129. * **outside the {@link #numFromEdge}** buffer as scrolling proceeds.
  130. */
  131. trailingBufferZone: 5,
  132.  
  133. /**
  134. * @cfg
  135. * The number of extra rows to render on the leading side of scrolling
  136. * **outside the {@link #numFromEdge}** buffer as scrolling proceeds.
  137. */
  138. leadingBufferZone: 15,
  139.  
  140. /**
  141. * @cfg
  142. * This is the time in milliseconds to buffer load requests when scrolling the PagingScrollbar.
  143. */
  144. scrollToLoadBuffer: 200,
  145.  
  146. // private. Initial value of zero.
  147. viewSize: 0,
  148. // private. Start at default value
  149. rowHeight: 21,
  150. // private. Table extent at startup time
  151. tableStart: 0,
  152. tableEnd: 0,
  153.  
  154. constructor: function (config) {
  155. var me = this;
  156. me.variableRowHeight = config.variableRowHeight;
  157. me.bindView(config.view);
  158. Ext.apply(me, config);
  159. me.callParent(arguments);
  160. },
  161.  
  162. bindView: function (view) {
  163. var me = this,
  164. viewListeners = {
  165. scroll: {
  166. fn: me.onViewScroll,
  167. element: 'el',
  168. scope: me
  169. },
  170. render: me.onViewRender,
  171. resize: me.onViewResize,
  172. boxready: {
  173. fn: me.onViewResize,
  174. scope: me,
  175. single: true
  176. },
  177. refresh: me.onViewRefresh,
  178. scope: me
  179. },
  180. storeListeners = {
  181. guaranteedrange: me.onGuaranteedRange,
  182. scope: me
  183. },
  184. gridListeners = {
  185. reconfigure: me.onGridReconfigure,
  186. scope: me
  187. };
  188.  
  189. console.log("bindView");
  190.  
  191. // If there are variable row heights, then in beforeRefresh, we have to find a common
  192. // row so that we can synchronize the table's top position after the refresh
  193. if (me.variableRowHeight) {
  194. viewListeners.beforerefresh = me.beforeViewRefresh;
  195. }
  196.  
  197. // If we need unbinding...
  198. if (me.view) {
  199. me.view.el.un('scroll', me.onViewScroll, me); // un does not understand the element options
  200. me.view.un(viewListeners);
  201. me.store.un(storeListeners);
  202. if (me.grid) {
  203. me.grid.un(gridListeners);
  204. }
  205. delete me.view.refreshSize; // Remove the injected refreshSize implementation
  206. }
  207.  
  208. me.view = view;
  209. me.grid = me.view.up('tablepanel');
  210. me.store = view.store;
  211. if (view.rendered) {
  212. me.viewSize = me.store.viewSize = Math.ceil(view.getHeight() / me.rowHeight) + me.trailingBufferZone + (me.numFromEdge * 2) + me.leadingBufferZone;
  213. }
  214.  
  215. // During scrolling we do not need to refresh the height - the Grid height must be set by config or layout in order to create a scrollable
  216. // table just larger than that, so removing the layout call improves efficiency and removes the flicker when the
  217. // HeaderContainer is reset to scrollLeft:0, and then resynced on the very next "scroll" event.
  218. me.view.refreshSize = Ext.Function.createInterceptor(me.view.refreshSize, me.beforeViewrefreshSize, me);
  219.  
  220. /**
  221. * @property {Number} position
  222. * Current pixel scroll position of the associated {@link Ext.view.Table View}.
  223. */
  224. me.position = 0;
  225.  
  226. // We are created in View constructor. There won't be an ownerCt at this time.
  227. if (me.grid) {
  228. me.grid.on(gridListeners);
  229. } else {
  230. me.view.on({
  231. added: function () {
  232. me.grid = me.view.up('tablepanel');
  233. me.grid.on(gridListeners);
  234. },
  235. single: true
  236. });
  237. }
  238.  
  239. me.view.on(me.viewListeners = viewListeners);
  240. me.store.on(storeListeners);
  241. },
  242.  
  243. onGridReconfigure: function (grid) {
  244. this.bindView(grid.view);
  245. },
  246.  
  247. // Ensure that the stretcher element is inserted into the View as the first element.
  248. onViewRender: function () {
  249. var me = this,
  250. el = me.view.el;
  251.  
  252. //console.log("onViewRender creatingStretcher ####### ");
  253.  
  254. el.setStyle('position', 'relative');
  255. me.stretcher = el.createChild({
  256. style: {
  257. position: 'absolute',
  258. width: '1px',
  259. height: 0,
  260. top: 0,
  261. left: 0
  262. }
  263. }, el.dom.firstChild);
  264. },
  265.  
  266. onViewResize: function (view, width, height) {
  267. var me = this,
  268. newViewSize;
  269.  
  270. //console.log("onViewResize ######");
  271.  
  272. newViewSize = Math.ceil(height / me.rowHeight) + me.trailingBufferZone + (me.numFromEdge * 2) + me.leadingBufferZone;
  273. if (newViewSize > me.viewSize) {
  274. me.viewSize = me.store.viewSize = newViewSize;
  275. me.handleViewScroll(me.lastScrollDirection || 1);
  276. }
  277. },
  278.  
  279. // Used for variable row heights. Try to find the offset from scrollTop of a common row
  280. beforeViewRefresh: function () {
  281. var me = this,
  282. view = me.view,
  283. rows,
  284. direction = me.lastScrollDirection;
  285.  
  286. me.commonRecordIndex = undefined;
  287.  
  288. // If we are refreshing in response to a scroll,
  289. // And we know where the previous start was,
  290. // and we're not teleporting out of visible range
  291. if (direction && (me.previousStart !== undefined) && (me.scrollProportion === undefined)) {
  292. rows = view.getNodes();
  293.  
  294. // We have scrolled downwards
  295. if (direction === 1) {
  296.  
  297. // If the ranges overlap, we are going to be able to position the table exactly
  298. if (me.tableStart <= me.previousEnd) {
  299. me.commonRecordIndex = rows.length - 1;
  300.  
  301. }
  302. }
  303. // We have scrolled upwards
  304. else if (direction === -1) {
  305.  
  306. // If the ranges overlap, we are going to be able to position the table exactly
  307. if (me.tableEnd >= me.previousStart) {
  308. me.commonRecordIndex = 0;
  309. }
  310. }
  311. // Cache the old offset of the common row from the scrollTop
  312. me.scrollOffset = -view.el.getOffsetsTo(rows[me.commonRecordIndex])[1];
  313.  
  314. // In the new table the common row is at a different index
  315. me.commonRecordIndex -= (me.tableStart - me.previousStart);
  316. } else {
  317. me.scrollOffset = undefined;
  318. }
  319. },
  320.  
  321. // Used for variable row heights. Try to find the offset from scrollTop of a common row
  322. // Ensure, upon each refresh, that the stretcher element is the correct height
  323. onViewRefresh: function () {
  324. var me = this,
  325. store = me.store,
  326. newScrollHeight,
  327. view = me.view,
  328. viewEl = view.el,
  329. viewDom = viewEl.dom,
  330. rows,
  331. newScrollOffset,
  332. scrollDelta,
  333. table = viewEl.child('table', true),
  334. tableTop,
  335. scrollTop;
  336.  
  337. // Scroll events caused by processing in here must be ignored, so disable for the duration
  338. me.disabled = true;
  339.  
  340. // No scroll monitoring is needed if
  341. // All data is in view OR
  342. // Store is filtered locally.
  343. // - scrolling a locally filtered page is obv a local operation within the context of a huge set of pages
  344. // so local scrolling is appropriate.
  345. if (store.getCount() === store.getTotalCount() || (store.isFiltered() && !store.remoteFilter)) {
  346. //console.log("onViewRefresh start");
  347. me.stretcher.setHeight(0);
  348. me.position = viewDom.scrollTop = 0;
  349.  
  350. // Chrome's scrolling went crazy upon zeroing of the stretcher, and left the view's scrollTop stuck at -15
  351. // This is the only thing that fixes that
  352. table.style.position = 'absolute';
  353.  
  354. // We remain disabled now because no scrolling is needed - we have the full dataset in the Store
  355. return;
  356. }
  357.  
  358. me.stretcher.setHeight(newScrollHeight = me.getScrollHeight());
  359.  
  360. //console.log("onViewRefresh: stretcher height=" + newScrollHeight);
  361.  
  362. scrollTop = viewDom.scrollTop;
  363.  
  364. // Flag to the refreshSize interceptor that regular refreshSize postprocessing should be vetoed.
  365. me.isScrollRefresh = (scrollTop > 0);
  366.  
  367. // If we have had to calculate the store position from the pure scroll bar position,
  368. // then we must calculate the table's vertical position from the scrollProportion
  369. // ~~~ workaround set to true
  370. if (true) {
  371. me.scrollProportion = scrollTop / (newScrollHeight - table.offsetHeight);
  372. table.style.position = 'absolute';
  373.  
  374. var tableTop = (me.scrollProportion ? (newScrollHeight * me.scrollProportion) - (table.offsetHeight * me.scrollProportion) : 0);
  375. //console.log("tableTop=" + tableTop);
  376.  
  377. table.style.top = tableTop + 'px';
  378. }
  379. else {
  380. table.style.position = 'absolute';
  381. table.style.top = (tableTop = (me.tableStart || 0) * me.rowHeight) + 'px';
  382.  
  383. // ScrollOffset to a common row was calculated in beforeViewRefresh, so we can synch table position with how it was before
  384. if (me.scrollOffset) {
  385. rows = view.getNodes();
  386. newScrollOffset = -viewEl.getOffsetsTo(rows[me.commonRecordIndex])[1];
  387. scrollDelta = newScrollOffset - me.scrollOffset;
  388. me.position = (scrollTop += scrollDelta);
  389. }
  390.  
  391. // If the table is not fully in view view, scroll to where it is in view.
  392. // This will happen when the page goes out of view unexpectedly, outside the
  393. // control of the PagingScroller. For example, a refresh caused by a remote sort or filter reverting
  394. // back to page 1.
  395. // Note that with buffered Stores, only remote sorting is allowed, otherwise the locally
  396. // sorted page will be out of order with the whole dataset.
  397. else if ((tableTop > scrollTop) || ((tableTop + table.offsetHeight) < scrollTop + viewDom.clientHeight)) {
  398. me.lastScrollDirection = -1;
  399. me.position = viewDom.scrollTop = tableTop;
  400. }
  401. }
  402.  
  403. // Re-enable upon function exit
  404. me.disabled = false;
  405. },
  406.  
  407. beforeViewrefreshSize: function () {
  408. // Veto the refreshSize if the refresh is due to a scroll.
  409. if (this.isScrollRefresh) {
  410. return (this.isScrollRefresh = false);
  411. }
  412. },
  413.  
  414. onGuaranteedRange: function (range, start, end) {
  415. var me = this,
  416. ds = me.store;
  417.  
  418. // this should never happen
  419. if (range.length && me.visibleStart < range[0].index) {
  420. return;
  421. }
  422.  
  423. // Cache last table position in dataset so that if we are using variableRowHeight,
  424. // we can attempt to locate a common row to align the table on.
  425. me.previousStart = me.tableStart;
  426. me.previousEnd = me.tableEnd;
  427.  
  428. me.tableStart = start;
  429. me.tableEnd = end;
  430. ds.loadRecords(range);
  431. },
  432.  
  433. onViewScroll: function (e, t) {
  434. var me = this,
  435. view = me.view,
  436. lastPosition = me.position;
  437.  
  438. me.position = view.el.dom.scrollTop;
  439.  
  440. //console.log("onViewScroll: scrollTop=" + view.el.dom.scrollTop);
  441.  
  442. // Only check for nearing the edge if we are enabled.
  443. // If there is no paging to be done (Store's dataset is all in memory) we will be disabled.
  444. if (!me.disabled) {
  445. me.lastScrollDirection = me.position > lastPosition ? 1 : -1;
  446. // Check the position so we ignore horizontal scrolling
  447. if (lastPosition !== me.position) {
  448. me.handleViewScroll(me.lastScrollDirection);
  449. }
  450. }
  451. },
  452.  
  453. handleViewScroll: function (direction) {
  454. var me = this,
  455. store = me.store,
  456. view = me.view,
  457. viewSize = me.viewSize,
  458. totalCount = store.getTotalCount(),
  459. highestStartPoint = totalCount - viewSize,
  460. visibleStart = me.getFirstVisibleRowIndex(),
  461. visibleEnd = me.getLastVisibleRowIndex(),
  462. requestStart,
  463. requestEnd;
  464.  
  465. //console.log("visibleStart=" + visibleStart + " visibleEnd=" + visibleEnd + " highestStartPoint=" + highestStartPoint);
  466.  
  467. // Only process if the total rows is larger than the visible page size
  468. if (totalCount >= viewSize) {
  469.  
  470. // This is only set if we are using variable row height, and the thumb is dragged so that
  471. // There are no remaining visible rows to vertically anchor the new table to.
  472. // In this case we use the scrollProprtion to anchor the table to the correct relative
  473. // position on the vertical axis.
  474. me.scrollProportion = undefined;
  475.  
  476. // We're scrolling up
  477. if (direction == -1) {
  478. if (visibleStart !== undefined) {
  479. if (visibleStart < (me.tableStart + me.numFromEdge)) {
  480. requestStart = Math.max(0, visibleEnd + me.trailingBufferZone - viewSize);
  481. }
  482. }
  483.  
  484. // The only way we can end up without a visible start is if, in variableRowHeight mode, the user drags
  485. // the thumb up out of the visible range. In this case, we have to estimate the start row index
  486. else {
  487. // ~~~ TODO
  488. //debugger;
  489. // If we have no visible rows to orientate with, then use the scroll proportion
  490. me.scrollProportion = view.el.dom.scrollTop / (view.el.dom.scrollHeight - view.el.dom.clientHeight);
  491. requestStart = Math.max(0, totalCount * me.scrollProportion - (viewSize / 2) - me.numFromEdge - ((me.leadingBufferZone + me.trailingBufferZone) / 2));
  492. }
  493. }
  494. // We're scrolling down
  495. else {
  496. if (visibleStart !== undefined) {
  497. if (visibleEnd > (me.tableEnd - me.numFromEdge)) {
  498. requestStart = Math.max(0, visibleStart - me.trailingBufferZone);
  499. }
  500. }
  501.  
  502. // The only way we can end up without a visible end is if, in variableRowHeight mode, the user drags
  503. // the thumb down out of the visible range. In this case, we have to estimate the start row index
  504. else {
  505. // ~~~ TODO
  506. //debugger;
  507. // If we have no visible rows to orientate with, then use the scroll proportion
  508. me.scrollProportion = view.el.dom.scrollTop / (view.el.dom.scrollHeight - view.el.dom.clientHeight);
  509. requestStart = totalCount * me.scrollProportion - (viewSize / 2) - me.numFromEdge - ((me.leadingBufferZone + me.trailingBufferZone) / 2);
  510. }
  511. }
  512.  
  513. // We scrolled close to the edge and the Store needs reloading
  514. if (requestStart !== undefined) {
  515. // The calculation walked off the end; Request the highest possible chunk which starts on an even row count (Because of row striping)
  516. if (requestStart > highestStartPoint) {
  517. requestStart = highestStartPoint & ~1;
  518. requestEnd = totalCount - 1;
  519. }
  520. // Make sure first row is even to ensure correct even/odd row striping
  521. else {
  522. requestStart = requestStart & ~1;
  523. requestEnd = requestStart + viewSize - 1;
  524. }
  525.  
  526. console.log("requestStart=" + requestStart + " requestEnd=" + requestEnd + " rangeCount=" + (requestEnd - requestStart) + " viewSize=" + viewSize);
  527.  
  528. // If range is satsfied within the prefetch buffer, then just draw it from the prefetch buffer
  529. if (store.rangeCached(requestStart, requestEnd)) {
  530. me.cancelLoad();
  531. store.guaranteeRange(requestStart, requestEnd);
  532. }
  533.  
  534. // Required range is not in the prefetch buffer. Ask the store to prefetch it.
  535. // We will recieve a guaranteedrange event when that is done.
  536. else {
  537. me.attemptLoad(requestStart, requestEnd);
  538. }
  539. }
  540. }
  541. },
  542.  
  543. getFirstVisibleRowIndex: function () {
  544. var me = this,
  545. store = me.store,
  546. view = me.view,
  547. scrollTop = view.el.dom.scrollTop,
  548. rows,
  549. count,
  550. i,
  551. rowBottom;
  552.  
  553. if (me.variableRowHeight) {
  554. // ~~~ TODO
  555. rows = view.getNodes();
  556. count = store.getCount();
  557. for (i = 0; i < count; i++) {
  558. rowBottom = Ext.fly(rows[i]).getOffsetsTo(view.el)[1] + rows[i].offsetHeight;
  559.  
  560. // Searching for the first visible row, and off the bottom of the clientArea, then there's no visible first row!
  561. if (rowBottom > view.el.dom.clientHeight) {
  562. return;
  563. }
  564.  
  565. if (rowBottom > 0) {
  566. return i + me.tableStart;
  567. }
  568. }
  569. } else {
  570. var pos = Math.floor(scrollTop / me.rowHeight);
  571.  
  572. // ~~~ workaround - get proportion from scroll
  573. var proportion = (MAX_EL_HEIGHT / (me.store.getTotalCount() * me.rowHeight));
  574.  
  575. // ~~~ workaround for end of record set, OR add to scroll height so it has more range.
  576. //proportion -= .001;
  577.  
  578. var adjustedScrollTop = Math.ceil(scrollTop / proportion);
  579. pos = Math.floor(adjustedScrollTop / me.rowHeight);
  580. console.log("adjustedScrollTop=" + adjustedScrollTop + " scrollTop=" + scrollTop + " MAX_EL_HEIGHT=" + MAX_EL_HEIGHT + " TRH=" + (me.store.getTotalCount() * me.rowHeight) + " proportion=" + proportion);
  581.  
  582. return pos;
  583. }
  584. },
  585.  
  586. getLastVisibleRowIndex: function () {
  587. var me = this,
  588. store = me.store,
  589. view = me.view,
  590. clientHeight = view.el.dom.clientHeight,
  591. rows,
  592. count,
  593. i,
  594. rowTop;
  595.  
  596. if (me.variableRowHeight) {
  597. // ~~~ TODO
  598. rows = view.getNodes();
  599. count = store.getCount();
  600. for (i = count - 1; i >= 0; i--) {
  601. rowTop = Ext.fly(rows[i]).getOffsetsTo(view.el)[1];
  602.  
  603. // Searching for the last visible row, and off the top of the clientArea, then there's no visible last row!
  604. if (rowTop < 0) {
  605. return;
  606. }
  607. if (rowTop < clientHeight) {
  608. return i + me.tableStart;
  609. }
  610. }
  611. } else {
  612. var end = me.getFirstVisibleRowIndex() + Math.ceil(clientHeight / me.rowHeight) + 1;
  613. //console.log("getLastVisibleRowIndex: end=" + end + " clientHeight=" + clientHeight);
  614. return end;
  615. }
  616. },
  617.  
  618. getScrollHeight: function () {
  619. var me = this,
  620. view = me.view,
  621. table,
  622. firstRow,
  623. store = me.store,
  624. deltaHeight = 0,
  625. doCalcHeight = !me.hasOwnProperty('rowHeight');
  626.  
  627. if (me.variableRowHeight) {
  628. table = me.view.el.down('table', true);
  629. if (doCalcHeight) {
  630. me.initialTableHeight = table.offsetHeight;
  631. me.rowHeight = me.initialTableHeight / me.store.getCount();
  632. } else {
  633. deltaHeight = table.offsetHeight - me.initialTableHeight;
  634. }
  635. } else if (doCalcHeight) {
  636. firstRow = view.el.down(view.getItemSelector());
  637. if (firstRow) {
  638. me.rowHeight = firstRow.getHeight(false, true);
  639. }
  640. }
  641.  
  642. var sh = Math.floor(store.getTotalCount() * me.rowHeight) + deltaHeight;;
  643.  
  644. // ~~~ workaround set scroll height;
  645. // Constrain scroll at all times
  646. // ~~~ workaround add some range so we can go a bit further for the end, 1000
  647. sh = MAX_EL_HEIGHT;
  648.  
  649. return sh;
  650. },
  651.  
  652. attemptLoad: function (start, end) {
  653. var me = this;
  654. if (me.scrollToLoadBuffer) {
  655. if (!me.loadTask) {
  656. me.loadTask = new Ext.util.DelayedTask(me.doAttemptLoad, me, []);
  657. }
  658. me.loadTask.delay(me.scrollToLoadBuffer, me.doAttemptLoad, me, [start, end]);
  659. } else {
  660. me.store.guaranteeRange(start, end);
  661. }
  662. },
  663.  
  664. cancelLoad: function () {
  665. if (this.loadTask) {
  666. this.loadTask.cancel();
  667. }
  668. },
  669.  
  670. doAttemptLoad: function (start, end) {
  671. this.store.guaranteeRange(start, end);
  672. },
  673.  
  674. destroy: function () {
  675. var me = this,
  676. scrollListener = me.viewListeners.scroll;
  677.  
  678. me.store.un({
  679. guaranteedrange: me.onGuaranteedRange,
  680. scope: me
  681. });
  682. me.view.un(me.viewListeners);
  683. if (me.view.rendered) {
  684. me.stretcher.remove();
  685. me.view.el.un('scroll', scrollListener.fn, scrollListener.scope);
  686. }
  687. }
  688. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement