Changeset 3
- Timestamp:
- 05/30/08 03:19:06 (4 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
CHANGELOG (modified) (1 diff)
-
src/BufferedGridView.js (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/CHANGELOG
r2 r3 1 2008-05-28 1 2008-05-29 2 ========== 3 - fixed: wrong calculation in BufferedGridView.onLiveScroll (based on lastScrollPosition and actual 4 scrollPosition) caused the view sometimes to not re-render some rows 5 - fixed: provided bug fix for "ensureVisible: returned x-coordinate does not take the x-position 6 of the gridpanel into account" (see http://extjs.com/forum/showthread.php?p=175331#post175331) 7 - enhancement: added cfg option "scrollDelay" in BufferedGridView for buffering calls to onLiveScroll 8 when scroll-event gets fired (thanks to Rich Waters) 9 10 11 2008-05-28 2 12 ========== 3 13 - fixed: wrong calculation of last displayable row after removing a row caused selection-model -
trunk/src/BufferedGridView.js
r2 r3 20 20 Ext.ux.grid.BufferedGridView = function(config) { 21 21 22 this.addEvents({ 23 /** 24 * @event beforebuffer 25 * Fires when the store is about to buffer new data. 26 * @param {Ext.ux.BufferedGridView} this 27 * @param {Ext.data.Store} store The store 28 * @param {Number} rowIndex 29 * @param {Number} visibleRows 30 * @param {Number} totalCount 31 */ 32 'beforebuffer' : true, 33 /** 34 * @event buffer 35 * Fires when the store is finsihed buffering new data. 36 * @param {Ext.ux.BufferedGridView} this 37 * @param {Ext.data.Store} store The store 38 * @param {Number} rowIndex 39 * @param {Number} visibleRows 40 * @param {Number} totalCount 41 */ 42 'buffer' : true, 43 /** 44 * @event cursormove 45 * Fires when the the user scrolls through the data. 46 * @param {Ext.ux.BufferedGridView} this 47 * @param {Number} rowIndex The index of the first visible row in the 48 * grid absolute to it's position in the model. 49 * @param {Number} visibleRows The number of rows visible in the grid. 50 * @param {Number} totalCount 51 */ 52 'cursormove' : true 53 54 }); 22 this.addEvents({ 23 /** 24 * @event beforebuffer 25 * Fires when the store is about to buffer new data. 26 * @param {Ext.ux.BufferedGridView} this 27 * @param {Ext.data.Store} store The store 28 * @param {Number} rowIndex 29 * @param {Number} visibleRows 30 * @param {Number} totalCount 31 */ 32 'beforebuffer' : true, 33 /** 34 * @event buffer 35 * Fires when the store is finsihed buffering new data. 36 * @param {Ext.ux.BufferedGridView} this 37 * @param {Ext.data.Store} store The store 38 * @param {Number} rowIndex 39 * @param {Number} visibleRows 40 * @param {Number} totalCount 41 */ 42 'buffer' : true, 43 /** 44 * @event cursormove 45 * Fires when the the user scrolls through the data. 46 * @param {Ext.ux.BufferedGridView} this 47 * @param {Number} rowIndex The index of the first visible row in the 48 * grid absolute to it's position in the model. 49 * @param {Number} visibleRows The number of rows visible in the grid. 50 * @param {Number} totalCount 51 */ 52 'cursormove' : true 53 54 }); 55 56 /** 57 * @cfg {Number} scrollDelay The number of microseconds a call to the 58 * onLiveScroll-lisener should be delayed when the scroll event fires 59 */ 55 60 56 61 /** … … 347 352 this.liveScroller = new E(cs[0]); 348 353 this.liveScrollerInset = this.liveScroller.dom.firstChild; 349 this.liveScroller.on('scroll', this.onLiveScroll, this );354 this.liveScroller.on('scroll', this.onLiveScroll, this, {buffer : this.scrollDelay}); 350 355 351 356 this.mainHd = new E(this.mainWrap.dom.firstChild); … … 934 939 { 935 940 var scrollTop = this.liveScroller.dom.scrollTop; 936 var pixelsSkipped = scrollTop-this.lastScrollPos;937 938 var rowsSkipped = Math.floor(pixelsSkipped/this.rowHeight);939 940 // happens when no scrolling actually happened941 if (pixelsSkipped == 0) {942 return;943 }944 941 945 942 var cursor = Math.floor((scrollTop)/this.rowHeight); 946 943 this.rowIndex = cursor; 947 // the lastRowIndex will be set when refreshing the view finished944 // the lastRowIndex will be set when refreshing the view has finished 948 945 if (cursor == this.lastRowIndex) { 949 946 return; 950 947 } 951 948 952 this.updateLiveRows(cursor, rowsSkipped); 953 949 this.updateLiveRows(cursor); 954 950 this.lastScrollPos = this.liveScroller.dom.scrollTop; 955 951 }, … … 1093 1089 if (!xy) { 1094 1090 return; 1095 } 1096 this.focusEl.setXY(xy); 1091 } 1092 this.focusEl.setXY(xy); 1093 1097 1094 if(Ext.isGecko){ 1098 1095 this.focusEl.focus(); … … 1115 1112 row = row.rowIndex; 1116 1113 } 1114 1117 1115 if(row < 0 || row >= this.ds.totalLength){ 1118 1116 return; … … 1124 1122 if (row >= this.rowIndex+this.visibleRows) { 1125 1123 this.adjustScrollerPos(((row-(this.rowIndex+this.visibleRows))+1)*this.rowHeight); 1126 } else if (row < this.rowIndex) {1124 } else if (row <= this.rowIndex) { 1127 1125 this.adjustScrollerPos((rowInd)*this.rowHeight); 1128 1126 } 1129 1127 var rowInd = rowInd < 0 ? row : rowInd; 1130 1128 var rowEl = this.getRow(rowInd), cellEl; 1129 1131 1130 if(!(hscroll === false && col === 0)){ 1132 1131 while(this.cm.isHidden(col)){ … … 1140 1139 1141 1140 var c = this.scroller.dom; 1142 1143 return cellEl ? Ext.fly(cellEl).getXY() : [c.scrollLeft, Ext.fly(rowEl).getY()]; 1141 1142 return cellEl ? 1143 Ext.fly(cellEl).getXY() : 1144 [c.scrollLeft+this.el.getX(), Ext.fly(rowEl).getY()]; 1144 1145 }, 1145 1146 … … 1504 1505 liveScroller.un('scroll', this.onLiveScroll, this); 1505 1506 } 1506 this.lastScrollPos = scrollDom.scrollTop;1507 this.lastScrollPos = scrollDom.scrollTop; 1507 1508 scrollDom.scrollTop += pixels; 1508 1509 1509 1510 if (suspendEvent === true) { 1510 1511 scrollDom.scrollTop = scrollDom.scrollTop; 1511 liveScroller.on('scroll', this.onLiveScroll, this );1512 liveScroller.on('scroll', this.onLiveScroll, this, {buffer : this.scrollDelay}); 1512 1513 } 1513 1514
