Changeset 68
- Timestamp:
- 01/04/10 14:36:15 (2 years ago)
- Files:
-
- 5 added
- 1 removed
- 12 modified
-
branches/Ext3.0 (deleted)
-
trunk/build/livegrid-all-debug.js (modified) (31 diffs)
-
trunk/build/livegrid-all.js (modified) (1 diff)
-
trunk/build/livegrid-core.js (modified) (1 diff)
-
trunk/build/resources/css/ext-ux-livegrid.css (modified) (1 diff)
-
trunk/CHANGELOG (modified) (1 diff)
-
trunk/examples (added)
-
trunk/examples/simple_grid (added)
-
trunk/examples/simple_grid/data.php (added)
-
trunk/examples/simple_grid/index.html (added)
-
trunk/examples/simple_grid/server.php (added)
-
trunk/src/EditorGridPanel.js (modified) (1 diff)
-
trunk/src/GridPanel.js (modified) (1 diff)
-
trunk/src/GridView.js (modified) (25 diffs)
-
trunk/src/JsonReader.js (modified) (2 diffs)
-
trunk/src/resources/css/ext-ux-livegrid.css (modified) (2 diffs)
-
trunk/src/Store.js (modified) (1 diff)
-
trunk/src/Toolbar.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/build/livegrid-all-debug.js
r60 r68 35 35 */ 36 36 Ext.ux.grid.livegrid.GridPanel = Ext.extend(Ext.grid.GridPanel, { 37 38 initComponent : function() 39 { 40 if (this.cls) { 41 this.cls += ' ext-ux-livegrid'; 42 } else { 43 this.cls = 'ext-ux-livegrid'; 44 } 45 46 Ext.ux.grid.livegrid.GridPanel.superclass.initComponent.call(this); 47 }, 37 48 38 49 /** … … 150 161 * @param {Number} totalCount 151 162 */ 152 'cursormove' : true 163 'cursormove' : true, 164 /** 165 * @event abortrequest 166 * Fires when the store is about to reload (this does NOT mean buffering). 167 * If you are using a custom proxy in your store, you should listen to this event 168 * and abort any ongoing server request established in your custom proxy. 169 * @param {Ext.data.Store} store 170 * @param {Object} options 171 */ 172 'abortrequest' : true 153 173 154 174 }); … … 187 207 this.horizontalScrollOffset = 17; 188 208 209 /** 210 * @type {Boolean} _checkEmptyBody Since Ext 3.0, would initially added to the mainBody 211 * as the first child if there are no rows to render. This element has to be removed when 212 * the first rows get added so the UI does not crash. This property is here to determine if 213 * this element was already removed, so we don't have to query innerHTML all the time. 214 */ 215 this._checkEmptyBody = true; 216 189 217 Ext.apply(this, config); 190 218 … … 195 223 */ 196 224 this.templates.master = new Ext.Template( 197 '<div class="x-grid3" hidefocus="true"><div class=" ext-ux-livegrid-liveScroller"><div></div></div>',225 '<div class="x-grid3" hidefocus="true"><div class="liveScroller"><div></div></div>', 198 226 '<div class="x-grid3-viewport"">', 199 '<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset" >{header}</div></div><div class="x-clear"></div></div>',200 '<div class="x-grid3-scroller" style="overflow-y:hidden !important;"><div class="x-grid3-body" >{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',227 '<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset" style="{ostyle}">{header}</div></div><div class="x-clear"></div></div>', 228 '<div class="x-grid3-scroller" style="overflow-y:hidden !important;"><div class="x-grid3-body" style="{bstyle}">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>', 201 229 "</div>", 202 230 '<div class="x-grid3-resize-marker"> </div>', … … 217 245 218 246 // {{{ --------------------------properties------------------------------------- 219 220 /**221 * Used to store the z-index of the mask that is used to show while buffering,222 * so the scrollbar can be displayed above of it.223 * @type {Number} _maskIndex224 */225 _maskIndex : 20001,226 247 227 248 /** … … 322 343 323 344 /** 345 * A shortcut to indicate whether the loadMask is currently being displayed. 346 * @type {Boolean} 347 * @private 348 */ 349 loadMaskDisplayed : false, 350 351 /** 324 352 * Set to <tt>true</tt> if a request for new data has been made while there 325 353 * are still rows in the buffer that can be rendered before the request … … 364 392 this.adjustScrollerPos(-this.liveScroller.dom.scrollTop, true); 365 393 this.showLoadMask(false); 394 395 var _ofn = this.processRows; 396 this.processRows = Ext.emptyFn; 366 397 this.refresh(true); 367 //this.replaceLiveRows(0, true); 398 this.processRows = _ofn; 399 this.processRows(0); 400 368 401 this.fireEvent('cursormove', this, 0, 369 402 Math.min(this.ds.totalLength, this.visibleRows-this.rowClipped), … … 388 421 389 422 // {{{ ------------adjusted methods for applying custom behavior---------------- 423 390 424 /** 391 425 * Overwritten so the {@link Ext.ux.grid.livegrid.DragZone} can be used … … 425 459 this._loadMaskAnchor.mask( 426 460 this.loadMask.msg, this.loadMask.msgCls 427 ); 428 this._loadMaskAnchor._mask.addClass('ext-ux-livegrid'); 429 this._loadMaskAnchor._mask.setDisplayed(false); 430 this._loadMaskAnchor._maskMsg.setDisplayed(false); 461 ); 462 var dom = this._loadMaskAnchor.dom; 463 var data = Ext.Element.data; 464 data(dom, 'mask').addClass('ext-ux-livegrid'); 465 data(dom, 'mask').setDisplayed(false); 466 data(dom, 'maskMsg').setDisplayed(false); 431 467 } 432 468 }, … … 561 597 var vw = csize.width; 562 598 563 if( vw < 20 || csize.height < 20){ // display: none?599 if(!g.hideHeaders && vw < 20 || csize.height < 20){ // display: none? 564 600 return; 565 601 } … … 567 603 if(g.autoHeight){ 568 604 this.scroller.dom.style.overflow = 'visible'; 605 if(Ext.isWebKit){ 606 this.scroller.dom.style.position = 'static'; 607 } 569 608 }else{ 570 609 this.el.setSize(csize.width, csize.height); … … 643 682 this.updateHeaderSortState(); 644 683 this.afterMove(newIndex); 684 this.grid.fireEvent('columnmove', oldIndex, newIndex); 645 685 }, 646 686 … … 679 719 } 680 720 681 this.addRowClass(row, "x-grid3-row-selected");721 this.addRowClass(row, this.selectedRowClass); 682 722 }, 683 723 … … 694 734 } 695 735 696 this.removeRowClass(row, "x-grid3-row-selected");736 this.removeRowClass(row, this.selectedRowClass); 697 737 }, 698 738 … … 814 854 onAdd : function(ds, records, index) 815 855 { 856 if (this._checkEmptyBody) { 857 if (this.mainBody.dom.innerHTML == ' ') { 858 this.mainBody.dom.innerHTML = ''; 859 } 860 this._checkEmptyBody = false; 861 } 862 816 863 var recordLen = records.length; 817 864 … … 921 968 * All other load events will be suspended when the view requests buffer data. 922 969 * See {updateLiveRows}. 970 * Note: 971 * If you are using a custom proxy, such as {Ext.data.DirectProxy}, you should listen 972 * to the 'abortrequest'-event, which will tell that an ongoing "read" request should be 973 * aborted, since the grid's store gets refreshed. 974 * If the store is using an instance of {Ext.data.HttpProxy}, the method will still be 975 * fired, but the request made through this proxy will be aborted automatically. 976 * 923 977 * 924 978 * @param {Ext.data.Store} store The store the Grid Panel uses … … 928 982 onBeforeLoad : function(store, options) 929 983 { 984 var proxy = store.proxy; 985 if (proxy.activeRequest && proxy.activeRequest[Ext.data.Api.actions.read]) { 986 proxy.getConnection().abort(proxy.activeRequest[Ext.data.Api.actions.read]); 987 } 988 this.fireEvent('abortrequest', store, options); 989 990 this.isBuffering = false; 991 this.isPreBuffering = false; 992 930 993 options.params = options.params || {}; 931 994 … … 1003 1066 ); 1004 1067 1005 this.isBuffering = false;1006 this.isPrebuffering = false;1007 this.showLoadMask(false);1008 1009 1068 // this is needed since references to records which have been unloaded 1010 1069 // get lost when the store gets loaded with new data. … … 1012 1071 this.grid.selModel.replaceSelections(records); 1013 1072 1073 this.isBuffering = false; 1074 this.isPrebuffering = false; 1075 this.showLoadMask(false); 1076 1077 if (this.requestQueue >= 0) { 1078 var offset = this.requestQueue; 1079 this.requestQueue = -1; 1080 this.updateLiveRows(offset); 1081 return; 1082 } 1014 1083 1015 1084 if (this.isInRange(this.rowIndex)) { … … 1019 1088 } 1020 1089 1021 if (this.requestQueue >= 0) {1022 var offset = this.requestQueue;1023 this.requestQueue = -1;1024 this.updateLiveRows(offset);1025 }1026 1090 1027 1091 return; … … 1107 1171 }, 1108 1172 1173 1109 1174 /** 1110 1175 * Overwritten so the rowIndex can be changed to the absolute index. … … 1116 1181 processRows : function(startRow, skipStripe, paintSelections) 1117 1182 { 1183 if(!this.ds || this.ds.getCount() < 1){ 1184 return; 1185 } 1186 1118 1187 skipStripe = skipStripe || !this.grid.stripeRows; 1119 // we will always process all rows in the view 1120 startRow = 0; 1121 var rows = this.getRows(); 1122 var cls = ' x-grid3-row-alt '; 1123 var cursor = this.rowIndex; 1124 1188 1189 var cursor = this.rowIndex; 1190 var rows = this.getRows(); 1125 1191 var index = 0; 1126 var selections = this.grid.selModel.selections; 1127 var ds = this.ds; 1128 var row = null; 1129 for(var i = startRow, len = rows.length; i < len; i++){ 1130 index = i+cursor; 1131 row = rows[i]; 1132 // changed! 1133 row.rowIndex = index; 1192 1193 var row = null; 1194 for (var idx = 0, len = rows.length; idx < len; idx++) { 1195 row = rows[idx]; 1196 1197 row.rowIndex = index = cursor+idx; 1198 row.className = row.className.replace(this.rowClsRe, ' '); 1199 if (!skipStripe && (index + 1) % 2 === 0) { 1200 row.className += ' x-grid3-row-alt'; 1201 } 1134 1202 1135 1203 if (paintSelections !== false) { 1136 1204 if (this.grid.selModel.isSelected(this.ds.getAt(index)) === true) { 1137 this.addRowClass(index, "x-grid3-row-selected");1205 this.addRowClass(index, this.selectedRowClass); 1138 1206 } else { 1139 this.removeRowClass(index, "x-grid3-row-selected");1207 this.removeRowClass(index, this.selectedRowClass); 1140 1208 } 1141 1209 this.fly(row).removeClass("x-grid3-row-over"); 1142 1210 } 1143 1144 if(!skipStripe){ 1145 var isAlt = ((index+1) % 2 == 0); 1146 var hasAlt = (' '+row.className + ' ').indexOf(cls) != -1; 1147 if(isAlt == hasAlt){ 1148 continue; 1149 } 1150 if(isAlt){ 1151 row.className += " x-grid3-row-alt"; 1152 }else{ 1153 row.className = row.className.replace("x-grid3-row-alt", ""); 1154 } 1155 } 1211 } 1212 1213 // add first/last-row classes 1214 if(cursor === 0){ 1215 Ext.fly(rows[0]).addClass(this.firstRowCls); 1216 } else if (cursor + rows.length == this.ds.totalLength) { 1217 Ext.fly(rows[rows.length - 1]).addClass(this.lastRowCls); 1156 1218 } 1157 1219 }, … … 1543 1605 showLoadMask : function(show) 1544 1606 { 1545 if (!this.loadMask ) {1607 if (!this.loadMask || show == this.loadMaskDisplayed) { 1546 1608 return; 1547 1609 } 1548 1610 1549 var mask = this._loadMaskAnchor._mask; 1550 var maskMsg = this._loadMaskAnchor._maskMsg; 1611 var dom = this._loadMaskAnchor.dom; 1612 var data = Ext.Element.data; 1613 1614 var mask = data(dom, 'mask'); 1615 var maskMsg = data(dom, 'maskMsg'); 1551 1616 1552 1617 if (show) { … … 1556 1621 // this lines will help IE8 to re-calculate the height of the loadmask 1557 1622 if(Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && this._loadMaskAnchor.getStyle('height') == 'auto'){ 1558 mask.setSize(undefined, this._loadMaskAnchor.getHeight());1559 }1623 mask.setSize(undefined, this._loadMaskAnchor.getHeight()); 1624 } 1560 1625 } else { 1561 1626 mask.setDisplayed(false); 1562 1627 maskMsg.setDisplayed(false); 1563 1628 } 1629 1630 this.loadMaskDisplayed = show; 1564 1631 }, 1565 1632 … … 1664 1731 return; 1665 1732 } else { 1666 this.scroller.setWidth(elWidth-this. scrollOffset);1733 this.scroller.setWidth(elWidth-this.getScrollOffset()); 1667 1734 liveScrollerDom.style.display = ''; 1668 1735 } 1669 1736 1670 var scrollbar = this.cm.getTotalWidth()+this. scrollOffset> elWidth;1737 var scrollbar = this.cm.getTotalWidth()+this.getScrollOffset() > elWidth; 1671 1738 1672 1739 // adjust the height of the scrollbar … … 1718 1785 var vh = size.height; 1719 1786 1720 var vw = width-this. scrollOffset;1787 var vw = width-this.getScrollOffset(); 1721 1788 // horizontal scrollbar shown? 1722 1789 if (cm.getTotalWidth() > vw) { … … 1834 1901 */ 1835 1902 1836 1903 buildExtractors : function() 1904 { 1905 if(this.ef){ 1906 return; 1907 } 1908 1909 var s = this.meta; 1910 1911 if(s.versionProperty) { 1912 this.getVersion = this.createAccessor(s.versionProperty); 1913 } 1914 1915 Ext.ux.grid.livegrid.JsonReader.superclass.buildExtractors.call(this); 1916 }, 1837 1917 1838 1918 /** … … 1846 1926 readRecords : function(o) 1847 1927 { 1848 var s = this.meta;1849 1850 if(!this.ef && s.versionProperty) {1851 this.getVersion = this.getJsonAccessor(s.versionProperty);1852 }1853 1854 1928 // shorten for future calls 1855 1929 if (!this.__readRecords) { 1856 1930 this.__readRecords = Ext.ux.grid.livegrid.JsonReader.superclass.readRecords; 1857 1931 } 1858 1859 1932 var intercept = this.__readRecords.call(this, o); 1860 1933 1861 1862 if (s.versionProperty) { 1934 if (this.meta.versionProperty) { 1863 1935 var v = this.getVersion(o); 1864 1936 intercept.version = (v === undefined || v === "") ? null : v; 1865 1937 } 1866 1867 1938 1868 1939 return intercept; … … 2856 2927 var max_i = ranges.length; 2857 2928 2858 if(max_i > 0 && !this.selectionsProxy.activeRequest 2929 if(max_i > 0 && !this.selectionsProxy.activeRequest[Ext.data.Api.actions.read] 2859 2930 && this.fireEvent("beforeselectionsload", this, ranges) !== false){ 2860 2931 … … 3286 3357 Ext.PagingToolbar.superclass.onRender.call(this, ct, position); 3287 3358 3288 this.loading = this.addButton({3359 this.loading = new Ext.Toolbar.Button({ 3289 3360 tooltip : this.refreshText, 3290 3361 iconCls : "x-tbar-loading", 3291 3362 handler : this.onClick.createDelegate(this, ["refresh"]) 3292 3363 }); 3364 3365 this.addButton(this.loading); 3293 3366 3294 3367 this.addSeparator(); … … 3463 3536 { 3464 3537 return Ext.ux.grid.livegrid.GridPanel.prototype.onRender.call(this, ct, position); 3538 }, 3539 3540 initComponent : function() 3541 { 3542 if (this.cls) { 3543 this.cls += ' ext-ux-livegrid'; 3544 } else { 3545 this.cls = 'ext-ux-livegrid'; 3546 } 3547 3548 return Ext.ux.grid.livegrid.EditorGridPanel.superclass.initComponent.call(this); 3465 3549 } 3466 3550 -
trunk/build/livegrid-all.js
r60 r68 1 Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.GridPanel=Ext.extend(Ext.grid.GridPanel,{ onRender:function(B,A){Ext.ux.grid.livegrid.GridPanel.superclass.onRender.call(this,B,A);var C=this.getStore();if(C._autoLoad===true){delete C._autoLoad;C.load()}},walkCells:function(H,C,F,E,D){var G=this.store;var A=G.getCount;G.getCount=G.getTotalCount;var B=Ext.ux.grid.livegrid.GridPanel.superclass.walkCells.call(this,H,C,F,E,D);G.getCount=A;return B}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.GridView=function(A){this.addEvents({beforebuffer:true,buffer:true,bufferfailure:true,cursormove:true});this.horizontalScrollOffset=17;Ext.apply(this,A);this.templates={};this.templates.master=new Ext.Template('<div class="x-grid3" hidefocus="true"><div class="ext-ux-livegrid-liveScroller"><div></div></div>','<div class="x-grid3-viewport"">','<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset">{header}</div></div><div class="x-clear"></div></div>','<div class="x-grid3-scroller" style="overflow-y:hidden !important;"><div class="x-grid3-body">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',"</div>",'<div class="x-grid3-resize-marker"> </div>','<div class="x-grid3-resize-proxy"> </div>',"</div>");this._gridViewSuperclass=Ext.ux.grid.livegrid.GridView.superclass;this._gridViewSuperclass.constructor.call(this)};Ext.extend(Ext.ux.grid.livegrid.GridView,Ext.grid.GridView,{_maskIndex:20001,hdHeight:0,rowClipped:0,liveScroller:null,liveScrollerInset:null,rowHeight:-1,visibleRows:1,lastIndex:-1,lastRowIndex:0,lastScrollPos:0,rowIndex:0,isBuffering:false,requestQueue:-1,loadMask:false,isPrebuffering:false,_loadMaskAnchor:null,reset:function(C){if(C===false){this.ds.modified=[];this.rowIndex=0;this.lastScrollPos=0;this.lastRowIndex=0;this.lastIndex=0;this.adjustVisibleRows();this.adjustScrollerPos(-this.liveScroller.dom.scrollTop,true);this.showLoadMask(false);this.refresh(true);this.fireEvent("cursormove",this,0,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);return false}else{var B={};var A=this.ds.sortInfo;if(A){B={dir:A.direction,sort:A.field}}return this.ds.load({params:B})}},renderUI:function(){var A=this.grid;var B=A.enableDragDrop||A.enableDrag;A.enableDragDrop=false;A.enableDrag=false;this._gridViewSuperclass.renderUI.call(this);var A=this.grid;A.enableDragDrop=B;A.enableDrag=B;if(B){this.dragZone=new Ext.ux.grid.livegrid.DragZone(A,{ddGroup:A.ddGroup||"GridDD"})}if(this.loadMask){this._loadMaskAnchor=Ext.get(this.mainBody.dom.parentNode.parentNode);Ext.apply(this.loadMask,{msgCls:"x-mask-loading"});this._loadMaskAnchor.mask(this.loadMask.msg,this.loadMask.msgCls);this._loadMaskAnchor._mask.addClass("ext-ux-livegrid");this._loadMaskAnchor._mask.setDisplayed(false);this._loadMaskAnchor._maskMsg.setDisplayed(false)}},init:function(A){this._gridViewSuperclass.init.call(this,A);A.on("expand",this._onExpand,this)},initData:function(B,A){if(this.ds){this.ds.un("bulkremove",this.onBulkRemove,this);this.ds.un("beforeload",this.onBeforeLoad,this)}if(B){B.on("bulkremove",this.onBulkRemove,this);B.on("beforeload",this.onBeforeLoad,this)}this._gridViewSuperclass.initData.call(this,B,A)},renderBody:function(){var A=this.renderRows(0,this.visibleRows-1);return this.templates.body.apply({rows:A})},doRender:function(C,B,E,A,D,F){return this._gridViewSuperclass.doRender.call(this,C,B,E,A+this.ds.bufferRange[0],D,F)},initElements:function(){var D=Ext.Element;var B=this.grid.getGridEl().dom.firstChild;var A=B.childNodes;this.el=new D(B);this.mainWrap=new D(A[1]);this.liveScroller=new D(A[0]);this.liveScrollerInset=this.liveScroller.dom.firstChild;this.liveScroller.on("scroll",this.onLiveScroll,this,{buffer:this.scrollDelay});var C=this.mainWrap.dom.firstChild;this.mainHd=new D(C);this.hdHeight=C.offsetHeight;this.innerHd=this.mainHd.dom.firstChild;this.scroller=new D(this.mainWrap.dom.childNodes[1]);if(this.forceFit){this.scroller.setStyle("overflow-x","hidden")}this.mainBody=new D(this.scroller.dom.firstChild);this.mainBody.on("mousewheel",this.handleWheel,this);this.focusEl=new D(this.scroller.dom.childNodes[1]);this.focusEl.swallowEvent("click",true);this.resizeMarker=new D(A[2]);this.resizeProxy=new D(A[3])},layout:function(){if(!this.mainBody){return }var E=this.grid;var G=E.getGridEl(),I=this.cm,B=E.autoExpandColumn,A=this;var C=G.getSize(true);var H=C.width;if(H<20||C.height<20){return }if(E.autoHeight){this.scroller.dom.style.overflow="visible"}else{this.el.setSize(C.width,C.height);var F=this.mainHd.getHeight();var D=C.height-(F);this.scroller.setSize(H,D);if(this.innerHd){this.innerHd.style.width=(H)+"px"}}this.liveScroller.dom.style.top=this.hdHeight+"px";if(this.forceFit){if(this.lastViewWidth!=H){this.fitColumns(false,false);this.lastViewWidth=H}}else{this.autoExpand()}this.adjustVisibleRows();this.adjustBufferInset();this.onLayout(H,D)},removeRow:function(A){Ext.removeNode(this.getRow(A))},removeRows:function(C,A){var B=this.mainBody.dom;for(var D=C;D<=A;D++){Ext.removeNode(B.childNodes[C])}},_onExpand:function(A){this.adjustVisibleRows();this.adjustBufferInset();this.adjustScrollerPos(this.rowHeight*this.rowIndex,true)},onColumnMove:function(A,C,B){this.indexMap=null;this.replaceLiveRows(this.rowIndex,true);this.updateHeaders();this.updateHeaderSortState();this.afterMove(B)},onColumnWidthUpdated:function(C,A,B){this.adjustVisibleRows();this.adjustBufferInset()},onAllColumnWidthsUpdated:function(A,B){this.adjustVisibleRows();this.adjustBufferInset()},onRowSelect:function(A){if(A<this.rowIndex||A>this.rowIndex+this.visibleRows){return }this.addRowClass(A,"x-grid3-row-selected")},onRowDeselect:function(A){if(A<this.rowIndex||A>this.rowIndex+this.visibleRows){return }this.removeRowClass(A,"x-grid3-row-selected")},onClear:function(){this.reset(false)},onBulkRemove:function(L,M){var H=null;var J=0;var O=0;var K=M.length;var A=false;var I=false;var F=0;if(K==0){return }var C=this.rowIndex;var B=0;var E=0;var D=0;for(var G=0;G<K;G++){H=M[G][0];J=M[G][1];O=(J!=Number.MIN_VALUE&&J!=Number.MAX_VALUE)?J+this.ds.bufferRange[0]:J;if(O<this.rowIndex){B++}else{if(O>=this.rowIndex&&O<=this.rowIndex+(this.visibleRows-1)){D++}else{if(O>=this.rowIndex+this.visibleRows){E++}}}this.fireEvent("beforerowremoved",this,O,H);this.fireEvent("rowremoved",this,O,H)}var N=this.ds.totalLength;this.rowIndex=Math.max(0,Math.min(this.rowIndex-B,N-(this.visibleRows-1)));this.lastRowIndex=this.rowIndex;this.adjustScrollerPos(-(B*this.rowHeight),true);this.updateLiveRows(this.rowIndex,true);this.adjustBufferInset();this.processRows(0,undefined,false)},onRemove:function(C,A,B){this.onBulkRemove(C,[[A,B]])},onAdd:function(B,C,G){var F=C.length;if(G==Number.MAX_VALUE||G==Number.MIN_VALUE){this.fireEvent("beforerowsinserted",this,G,G);if(G==Number.MIN_VALUE){this.rowIndex=this.rowIndex+F;this.lastRowIndex=this.rowIndex;this.adjustBufferInset();this.adjustScrollerPos(this.rowHeight*F,true);this.fireEvent("rowsinserted",this,G,G,F);this.processRows(0,undefined,false);this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);return }this.adjustBufferInset();this.fireEvent("rowsinserted",this,G,G,F);return }var A=G+this.ds.bufferRange[0];var E=A+(F-1);var H=this.getRows().length;var D=0;var I=0;if(A>this.rowIndex+(this.visibleRows-1)){this.fireEvent("beforerowsinserted",this,A,E);this.fireEvent("rowsinserted",this,A,E,F);this.adjustVisibleRows();this.adjustBufferInset()}else{if(A>=this.rowIndex&&A<=this.rowIndex+(this.visibleRows-1)){D=G;I=G+(F-1);this.lastRowIndex=this.rowIndex;this.rowIndex=(A>this.rowIndex)?this.rowIndex:A;this.insertRows(B,D,I);if(this.lastRowIndex!=this.rowIndex){this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength)}this.adjustVisibleRows();this.adjustBufferInset()}else{if(A<this.rowIndex){this.fireEvent("beforerowsinserted",this,A,E);this.rowIndex=this.rowIndex+F;this.lastRowIndex=this.rowIndex;this.adjustVisibleRows();this.adjustBufferInset();this.adjustScrollerPos(this.rowHeight*F,true);this.fireEvent("rowsinserted",this,A,E,F);this.processRows(0,undefined,true);this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength)}}}},onBeforeLoad:function(B,C){C.params=C.params||{};var A=Ext.apply;A(C,{scope:this,callback:function(){this.reset(false)},suspendLoadEvent:false});A(C.params,{start:0,limit:this.ds.bufferSize});return true},onLoad:function(C,B,A){this.adjustBufferInset()},onDataChange:function(A){this.updateHeaderSortState()},liveBufferUpdate:function(A,B,D){if(D===true){this.adjustBufferInset();this.fireEvent("buffer",this,this.ds,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength,B);this.isBuffering=false;this.isPrebuffering=false;this.showLoadMask(false);this.grid.selModel.replaceSelections(A);if(this.isInRange(this.rowIndex)){this.replaceLiveRows(this.rowIndex,B.forceRepaint)}else{this.updateLiveRows(this.rowIndex)}if(this.requestQueue>=0){var C=this.requestQueue;this.requestQueue=-1;this.updateLiveRows(C)}return }else{this.fireEvent("bufferfailure",this,this.ds,B)}this.requestQueue=-1;this.isBuffering=false;this.isPrebuffering=false;this.showLoadMask(false)},handleWheel:function(A){if(this.rowHeight==-1){A.stopEvent();return }var B=A.getWheelDelta();this.adjustScrollerPos(-(B*this.rowHeight));A.stopEvent()},onLiveScroll:function(){var A=this.liveScroller.dom.scrollTop;var B=Math.floor((A)/this.rowHeight);this.rowIndex=B;if(B==this.lastRowIndex){return }this.updateLiveRows(B);this.lastScrollPos=this.liveScroller.dom.scrollTop},refreshRow:function(A){var D=this.ds,C;if(typeof A=="number"){C=A;A=D.getAt(C)}else{C=D.indexOf(A)}var B=C+this.ds.bufferRange[0];if(B<this.rowIndex||B>=this.rowIndex+this.visibleRows){this.fireEvent("rowupdated",this,B,A);return }this.insertRows(D,C,C,true);this.fireEvent("rowupdated",this,B,A)},processRows:function(I,H,E){H=H||!this.grid.stripeRows;I=0;var N=this.getRows();var K=" x-grid3-row-alt ";var J=this.rowIndex;var G=0;var A=this.grid.selModel.selections;var B=this.ds;var M=null;for(var D=I,F=N.length;D<F;D++){G=D+J;M=N[D];M.rowIndex=G;if(E!==false){if(this.grid.selModel.isSelected(this.ds.getAt(G))===true){this.addRowClass(G,"x-grid3-row-selected")}else{this.removeRowClass(G,"x-grid3-row-selected")}this.fly(M).removeClass("x-grid3-row-over")}if(!H){var C=((G+1)%2==0);var L=(" "+M.className+" ").indexOf(K)!=-1;if(C==L){continue}if(C){M.className+=" x-grid3-row-alt"}else{M.className=M.className.replace("x-grid3-row-alt","")}}}},insertRows:function(E,B,M,L){var A=B+this.ds.bufferRange[0];var F=M+this.ds.bufferRange[0];if(!L){this.fireEvent("beforerowsinserted",this,A,F)}if(L!==true&&(this.getRows().length+(M-B))>=this.visibleRows){this.removeRows((this.visibleRows-1)-(M-B),this.visibleRows-1)}else{if(L){this.removeRows(A-this.rowIndex,F-this.rowIndex)}}var G=(B==M)?M:Math.min(M,(this.rowIndex-this.ds.bufferRange[0])+(this.visibleRows-1));var D=this.renderRows(B,G);var I=this.getRow(A);if(I){Ext.DomHelper.insertHtml("beforeBegin",I,D)}else{Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,D)}if(L===true){var K=this.getRows();var J=this.rowIndex;for(var C=0,H=K.length;C<H;C++){K[C].rowIndex=J+C}}if(!L){this.fireEvent("rowsinserted",this,A,F,(F-A)+1);this.processRows(0,undefined,true)}},getRow:function(A){if(A-this.rowIndex<0){return null}return this.getRows()[A-this.rowIndex]},getCell:function(B,A){var B=this.getRow(B);return B?B.getElementsByTagName("td")[A]:null},focusCell:function(D,A,C){var B=this.ensureVisible(D,A,C);if(!B){return }this.focusEl.setXY(B);if(Ext.isGecko){this.focusEl.focus()}else{this.focusEl.focus.defer(1,this.focusEl)}},ensureVisible:function(K,C,B){if(typeof K!="number"){K=K.rowIndex}if(K<0||K>=this.ds.totalLength){return }C=(C!==undefined?C:0);var H=K-this.rowIndex;if(this.rowClipped&&K==this.rowIndex+this.visibleRows-1){this.adjustScrollerPos(this.rowHeight)}else{if(K>=this.rowIndex+this.visibleRows){this.adjustScrollerPos(((K-(this.rowIndex+this.visibleRows))+1)*this.rowHeight)}else{if(K<=this.rowIndex){this.adjustScrollerPos((H)*this.rowHeight)}}}var G=this.getRow(K),D;if(!G){return }if(!(B===false&&C===0)){while(this.cm.isHidden(C)){C++}D=this.getCell(K,C)}var J=this.scroller.dom;if(B!==false){var I=parseInt(D.offsetLeft,10);var F=I+D.offsetWidth;var E=parseInt(J.scrollLeft,10);var A=E+J.clientWidth;if(I<E){J.scrollLeft=I}else{if(F>A){J.scrollLeft=F-J.clientWidth}}}return D?Ext.fly(D).getXY():[J.scrollLeft+this.el.getX(),Ext.fly(G).getY()]},isRecordRendered:function(A){var B=this.ds.indexOf(A);if(B>=this.rowIndex&&B<this.rowIndex+this.visibleRows){return true}return false},isInRange:function(B){var A=Math.min(this.ds.totalLength-1,B+(this.visibleRows-1));return(B>=this.ds.bufferRange[0])&&(A<=this.ds.bufferRange[1])},getPredictedBufferIndex:function(A,B,C){if(!B){if(A+this.ds.bufferSize>=this.ds.totalLength){return this.ds.totalLength-this.ds.bufferSize}return Math.max(0,(A+this.visibleRows)-Math.round(this.ds.bufferSize/2))}if(!C){return Math.max(0,(A-this.ds.bufferSize)+this.visibleRows)}if(C){return Math.max(0,Math.min(A,this.ds.totalLength-this.ds.bufferSize))}},updateLiveRows:function(G,H,D){var J=this.isInRange(G);if(this.isBuffering){if(this.isPrebuffering){if(J){this.replaceLiveRows(G,H)}else{this.showLoadMask(true)}}this.fireEvent("cursormove",this,G,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);this.requestQueue=G;return }var E=this.lastIndex;this.lastIndex=G;var J=this.isInRange(G);var I=false;if(J&&D!==true){this.replaceLiveRows(G,H);this.fireEvent("cursormove",this,G,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);if(G>E){I=true;var K=this.ds.totalLength;if(G+this.visibleRows+this.nearLimit<=this.ds.bufferRange[1]){return }if(this.ds.bufferRange[1]+1>=K){return }}else{if(G<E){I=false;if(this.ds.bufferRange[0]<=0){return }if(G-this.nearLimit>this.ds.bufferRange[0]){return }}else{return }}this.isPrebuffering=true}this.isBuffering=true;var B=this.getPredictedBufferIndex(G,J,I);if(!J){this.showLoadMask(true)}this.ds.suspendEvents();var F=this.ds.sortInfo;var C={};if(this.ds.lastOptions){Ext.apply(C,this.ds.lastOptions.params)}C.start=B;C.limit=this.ds.bufferSize;if(F){C.dir=F.direction;C.sort=F.field}var A={forceRepaint:H,callback:this.liveBufferUpdate,scope:this,params:C,suspendLoadEvent:true};this.fireEvent("beforebuffer",this,this.ds,G,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength,A);this.ds.load(A);this.ds.resumeEvents()},showLoadMask:function(B){if(!this.loadMask){return }var A=this._loadMaskAnchor._mask;var C=this._loadMaskAnchor._maskMsg;if(B){A.setDisplayed(true);C.setDisplayed(true);C.center(this._loadMaskAnchor);if(Ext.isIE&&!(Ext.isIE7&&Ext.isStrict)&&this._loadMaskAnchor.getStyle("height")=="auto"){A.setSize(undefined,this._loadMaskAnchor.getHeight())}}else{A.setDisplayed(false);C.setDisplayed(false)}},replaceLiveRows:function(H,G,C){var D=H-this.lastRowIndex;if(D==0&&G!==true){return }var A=D>0;D=Math.abs(D);var B=this.ds.bufferRange;var I=H-B[0];var E=Math.min(I+this.visibleRows-1,B[1]-B[0]);if(D>=this.visibleRows||D==0){this.mainBody.update(this.renderRows(I,E))}else{if(A){this.removeRows(0,D-1);if(I+this.visibleRows-D<=B[1]-B[0]){var F=this.renderRows(I+this.visibleRows-D,E);Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,F)}}else{this.removeRows(this.visibleRows-D,this.visibleRows-1);var F=this.renderRows(I,I+D-1);Ext.DomHelper.insertHtml("beforeBegin",this.mainBody.dom.firstChild,F)}}if(C!==false){this.processRows(0,undefined,true)}this.lastRowIndex=H},adjustBufferInset:function(){var B=this.liveScroller.dom;var D=this.grid,E=D.store;var H=D.getGridEl();var C=H.getSize().width;var F=(E.totalLength==this.visibleRows-this.rowClipped)?0:Math.max(0,E.totalLength-(this.visibleRows-this.rowClipped));if(F==0){this.scroller.setWidth(C);B.style.display="none";return }else{this.scroller.setWidth(C-this.scrollOffset);B.style.display=""}var G=this.cm.getTotalWidth()+this.scrollOffset>C;var A=B.parentNode.offsetHeight+((E.totalLength>0&&G)?-this.horizontalScrollOffset:0)-this.hdHeight;B.style.height=Math.max(A,this.horizontalScrollOffset*2)+"px";if(this.rowHeight==-1){return }this.liveScrollerInset.style.height=(F==0?0:A+(F*this.rowHeight))+"px"},adjustVisibleRows:function(){if(this.rowHeight==-1){if(this.getRows()[0]){this.rowHeight=this.getRows()[0].offsetHeight;if(this.rowHeight<=0){this.rowHeight=-1;return }}else{return }}var E=this.grid,C=E.store;var F=E.getGridEl();var H=this.cm;var J=F.getSize();var B=J.width;var D=J.height;var G=B-this.scrollOffset;if(H.getTotalWidth()>G){D-=this.horizontalScrollOffset}D-=this.mainHd.getHeight();var I=C.totalLength||0;var A=Math.max(1,Math.floor(D/this.rowHeight));this.rowClipped=0;if(I>A&&this.rowHeight/3<(D-(A*this.rowHeight))){A=Math.min(A+1,I);this.rowClipped=1}if(this.visibleRows==A){return }this.visibleRows=A;if(this.isBuffering&&!this.isPrebuffering){return }if(this.rowIndex+(A-this.rowClipped)>I){this.rowIndex=Math.max(0,I-(A-this.rowClipped));this.lastRowIndex=this.rowIndex}this.updateLiveRows(this.rowIndex,true)},adjustScrollerPos:function(D,A){if(D==0){return }var C=this.liveScroller;var B=C.dom;if(A===true){C.un("scroll",this.onLiveScroll,this)}this.lastScrollPos=B.scrollTop;B.scrollTop+=D;if(A===true){B.scrollTop=B.scrollTop;C.on("scroll",this.onLiveScroll,this,{buffer:this.scrollDelay})}}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.JsonReader=function(A,B){Ext.ux.grid.livegrid.JsonReader.superclass.constructor.call(this,A,B)};Ext.extend(Ext.ux.grid.livegrid.JsonReader,Ext.data.JsonReader,{readRecords:function(D){var B=this.meta;if(!this.ef&&B.versionProperty){this.getVersion=this.getJsonAccessor(B.versionProperty)}if(!this.__readRecords){this.__readRecords=Ext.ux.grid.livegrid.JsonReader.superclass.readRecords}var C=this.__readRecords.call(this,D);if(B.versionProperty){var A=this.getVersion(D);C.version=(A===undefined||A==="")?null:A}return C}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.RowSelectionModel=function(A){this.addEvents({selectiondirty:true});Ext.apply(this,A);this.pendingSelections={};Ext.ux.grid.livegrid.RowSelectionModel.superclass.constructor.call(this)};Ext.extend(Ext.ux.grid.livegrid.RowSelectionModel,Ext.grid.RowSelectionModel,{initEvents:function(){Ext.ux.grid.livegrid.RowSelectionModel.superclass.initEvents.call(this);this.grid.view.on("rowsinserted",this.onAdd,this);this.grid.store.on("selectionsload",this.onSelectionsLoad,this)},onRemove:function(B,D,G){var A=this.getPendingSelections();var C=A.length;var F=false;if(D==Number.MIN_VALUE||D==Number.MAX_VALUE){if(G){if(this.isIdSelected(G.id)&&D==Number.MIN_VALUE){this.shiftSelections(this.grid.store.bufferRange[1],-1)}this.selections.remove(G);F=true}if(D==Number.MIN_VALUE){this.clearPendingSelections(0,this.grid.store.bufferRange[0])}else{this.clearPendingSelections(this.grid.store.bufferRange[1])}if(C!=0){this.fireEvent("selectiondirty",this,D,1)}}else{F=this.isIdSelected(G.id);if(!F){return }this.selections.remove(G);if(C!=0){var H=A[0];var E=A[C-1];if(D<=E||D<=H){this.shiftSelections(D,-1);this.fireEvent("selectiondirty",this,D,1)}}}if(F){this.fireEvent("selectionchange",this)}},onAdd:function(G,E,D,B){var A=this.getPendingSelections();var H=A.length;if((E==Number.MIN_VALUE||E==Number.MAX_VALUE)){if(E==Number.MIN_VALUE){this.clearPendingSelections(0,this.grid.store.bufferRange[0]);this.shiftSelections(this.grid.store.bufferRange[1],B)}else{this.clearPendingSelections(this.grid.store.bufferRange[1])}if(H!=0){this.fireEvent("selectiondirty",this,E,r)}return }var F=A[0];var C=A[H-1];var I=E;if(I<=C||I<=F){this.fireEvent("selectiondirty",this,I,B);this.shiftSelections(I,B)}},shiftSelections:function(L,C){var H=0;var K=0;var B={};var D=this.grid.store;var I=L-D.bufferRange[0];var F=0;var M=this.grid.store.totalLength;var E=null;var A=this.getPendingSelections();var J=A.length;if(J==0){return }for(var G=0;G<J;G++){H=A[G];if(H<L){continue}K=H+C;F=I+C;if(K>=M){break}E=D.getAt(F);if(E){this.selections.add(E)}else{B[K]=true}}this.pendingSelections=B},onSelectionsLoad:function(C,B,A){this.replaceSelections(B)},hasNext:function(){return this.last!==false&&(this.last+1)<this.grid.store.getTotalCount()},getCount:function(){return this.selections.length+this.getPendingSelections().length},isSelected:function(A){if(typeof A=="number"){var B=A;A=this.grid.store.getAt(B);if(!A){var D=this.getPendingSelections().indexOf(B);if(D!=-1){return true}return false}}var C=A;return(C&&this.selections.key(C.id)?true:false)},deselectRecord:function(A,C){if(this.locked){return }var E=this.selections.key(A.id);if(!E){return }var B=this.grid.store;var D=B.indexOfId(A.id);if(D==-1){D=B.findInsertIndex(A);if(D!=Number.MIN_VALUE&&D!=Number.MAX_VALUE){D+=B.bufferRange[0]}}else{delete this.pendingSelections[D]}if(this.last==D){this.last=false}if(this.lastActive==D){this.lastActive=false}this.selections.remove(A);if(!C){this.grid.getView().onRowDeselect(D)}this.fireEvent("rowdeselect",this,D,A);this.fireEvent("selectionchange",this)},deselectRow:function(B,A){if(this.locked){return }if(this.last==B){this.last=false}if(this.lastActive==B){this.lastActive=false}var C=this.grid.store.getAt(B);delete this.pendingSelections[B];if(C){this.selections.remove(C)}if(!A){this.grid.getView().onRowDeselect(B)}this.fireEvent("rowdeselect",this,B,C);this.fireEvent("selectionchange",this)},selectRow:function(B,D,A){if(this.locked||B<0||B>=this.grid.store.getTotalCount()){return }var C=this.grid.store.getAt(B);if(this.fireEvent("beforerowselect",this,B,D,C)!==false){if(!D||this.singleSelect){this.clearSelections()}if(C){this.selections.add(C);delete this.pendingSelections[B]}else{this.pendingSelections[B]=true}this.last=this.lastActive=B;if(!A){this.grid.getView().onRowSelect(B)}this.fireEvent("rowselect",this,B,C);this.fireEvent("selectionchange",this)}},clearPendingSelections:function(G,F){if(F==undefined){F=Number.MAX_VALUE}var B={};var A=this.getPendingSelections();var D=A.length;var C=0;for(var E=0;E<D;E++){C=A[E];if(C<=F&&C>=G){continue}B[C]=true}this.pendingSelections=B},replaceSelections:function(E){if(!E||E.length==0){return }var D=this.grid.store;var F=null;var I=[];var A=this.getPendingSelections();var J=A.length;var C=this.selections;var H=0;for(var G=0;G<J;G++){H=A[G];F=D.getAt(H);if(F){C.add(F);I.push(F.id);delete this.pendingSelections[H]}}var B=null;for(G=0,len=E.length;G<len;G++){F=E[G];B=F.id;if(I.indexOf(B)==-1&&C.containsKey(B)){C.add(F)}}},getPendingSelections:function(F){var D=1;var C=[];var B=0;var G=[];for(var E in this.pendingSelections){G.push(parseInt(E))}G.sort(function(I,H){if(I>H){return 1}else{if(I<H){return -1}else{return 0}}});if(!F){return G}var A=G.length;if(A==0){return[]}C[B]=[G[0],G[0]];for(var E=0,A=A-1;E<A;E++){if(G[E+1]-G[E]==1){C[B][1]=G[E+1]}else{B++;C[B]=[G[E+1],G[E+1]]}}return C},clearSelections:function(A){if(this.locked){return }if(A!==true){var D=this.grid.store;var B=this.selections;var C=-1;B.each(function(E){C=D.indexOfId(E.id);if(C!=-1){this.deselectRow(C+D.bufferRange[0])}},this);B.clear();this.pendingSelections={}}else{this.selections.clear();this.pendingSelections={}}this.last=false},selectRange:function(B,A,D){if(this.locked){return }if(!D){this.clearSelections()}if(B<=A){for(var C=B;C<=A;C++){this.selectRow(C,true)}}else{for(var C=B;C>=A;C--){this.selectRow(C,true)}}}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.Store=function(A){A=A||{};A.remoteSort=true;this._autoLoad=A.autoLoad?true:false;A.autoLoad=false;this.addEvents("bulkremove","versionchange","beforeselectionsload","selectionsload");Ext.ux.grid.livegrid.Store.superclass.constructor.call(this,A);this.totalLength=0;this.bufferRange=[-1,-1];this.on("clear",function(){this.bufferRange=[-1,-1]},this);if(this.url&&!this.selectionsProxy){this.selectionsProxy=new Ext.data.HttpProxy({url:this.url})}};Ext.extend(Ext.ux.grid.livegrid.Store,Ext.data.Store,{version:null,insert:function(D,C){C=[].concat(C);D=D>=this.bufferSize?Number.MAX_VALUE:D;if(D==Number.MIN_VALUE||D==Number.MAX_VALUE){var B=C.length;if(D==Number.MIN_VALUE){this.bufferRange[0]+=B;this.bufferRange[1]+=B}this.totalLength+=B;this.fireEvent("add",this,C,D);return }var F=false;var G=C;if(C.length+D>=this.bufferSize){F=true;G=C.splice(0,this.bufferSize-D)}this.totalLength+=G.length;if(this.bufferRange[0]<=-1){this.bufferRange[0]=0}if(this.bufferRange[1]<(this.bufferSize-1)){this.bufferRange[1]=Math.min(this.bufferRange[1]+G.length,this.bufferSize-1)}for(var E=0,A=G.length;E<A;E++){this.data.insert(D,G[E]);G[E].join(this)}while(this.getCount()>this.bufferSize){this.data.remove(this.data.last())}this.fireEvent("add",this,G,D);if(F==true){this.fireEvent("add",this,C,Number.MAX_VALUE)}},remove:function(B,A){var C=this._getIndex(B);if(C<0){this.totalLength-=1;if(this.pruneModifiedRecords){this.modified.remove(B)}this.bufferRange[0]=Math.max(-1,this.bufferRange[0]-1);this.bufferRange[1]=Math.max(-1,this.bufferRange[1]-1);if(A!==true){this.fireEvent("remove",this,B,C)}return C}this.bufferRange[1]=Math.max(-1,this.bufferRange[1]-1);this.data.removeAt(C);if(this.pruneModifiedRecords){this.modified.remove(B)}this.totalLength-=1;if(A!==true){this.fireEvent("remove",this,B,C)}return C},_getIndex:function(A){var B=this.indexOfId(A.id);if(B<0){B=this.findInsertIndex(A)}return B},bulkRemove:function(B){var G=null;var E=[];var D=0;var A=B.length;var F=[];for(var C=0;C<A;C++){G=B[C];F[G.id]=this._getIndex(G)}for(var C=0;C<A;C++){G=B[C];this.remove(G,true);E.push([G,F[G.id]])}this.fireEvent("bulkremove",this,E)},removeAll:function(){this.totalLength=0;this.bufferRange=[-1,-1];this.data.clear();if(this.pruneModifiedRecords){this.modified=[]}this.fireEvent("clear",this)},loadRanges:function(B){var A=B.length;if(A>0&&!this.selectionsProxy.activeRequest&&this.fireEvent("beforeselectionsload",this,B)!==false){var E=this.lastOptions.params;var F={};F.ranges=Ext.encode(B);if(E){if(E.sort){F.sort=E.sort}if(E.dir){F.dir=E.dir}}var C={};for(var D in this.lastOptions){C.i=this.lastOptions.i}C.ranges=F.ranges;this.selectionsProxy.load(F,this.reader,this.selectionsLoaded,this,C)}},loadSelections:function(A){if(A.length==0){return }this.loadRanges(A)},selectionsLoaded:function(F,B,E){if(this.checkVersionChange(F,B,E)!==false){var D=F.records;for(var C=0,A=D.length;C<A;C++){D[C].join(this)}this.fireEvent("selectionsload",this,F.records,Ext.decode(B.ranges))}else{this.fireEvent("selectionsload",this,[],Ext.decode(B.ranges))}},checkVersionChange:function(D,B,C){if(D&&C!==false){if(D.version!==undefined){var A=this.version;this.version=D.version;if(this.version!==A){return this.fireEvent("versionchange",this,A,this.version)}}}},findInsertIndex:function(A){this.remoteSort=false;var B=Ext.ux.grid.livegrid.Store.superclass.findInsertIndex.call(this,A);this.remoteSort=true;if(this.bufferRange[0]<=0&&B==0){return B}else{if(this.bufferRange[0]>0&&B==0){return Number.MIN_VALUE}else{if(B>=this.bufferSize){return Number.MAX_VALUE}}}return B},sortData:function(C,D){D=D||"ASC";var A=this.fields.get(C).sortType;var B=function(F,E){var H=A(F.data[C]),G=A(E.data[C]);return H>G?1:(H<G?-1:0)};this.data.sort(D,B)},onMetaChange:function(B,A,C){this.version=null;Ext.ux.grid.livegrid.Store.superclass.onMetaChange.call(this,B,A,C)},loadRecords:function(C,A,B){this.checkVersionChange(C,A,B);if(!C){this.bufferRange=[-1,-1]}else{this.bufferRange=[A.params.start,Math.max(0,Math.min((A.params.start+A.params.limit)-1,C.totalRecords-1))]}if(A.suspendLoadEvent===true){this.suspendEvents()}Ext.ux.grid.livegrid.Store.superclass.loadRecords.call(this,C,A,B);if(A.suspendLoadEvent===true){this.resumeEvents()}},getAt:function(A){if(this.bufferRange[0]==-1){return undefined}var B=A-this.bufferRange[0];return this.data.itemAt(B)},clearFilter:function(){},isFiltered:function(){},collect:function(){},createFilterFn:function(){},sum:function(){},filter:function(){},filterBy:function(){},query:function(){},queryBy:function(){},find:function(){},findBy:function(){}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.Toolbar=Ext.extend(Ext.Toolbar,{displayMsg:"Displaying {0} - {1} of {2}",emptyMsg:"No data to display",refreshText:"Refresh",initComponent:function(){Ext.ux.grid.livegrid.Toolbar.superclass.initComponent.call(this);if(this.grid){this.view=this.grid.getView()}var A=this;this.view.init=this.view.init.createSequence(function(){A.bind(this)},this.view)},updateInfo:function(D,C,A){if(this.displayEl){var B=A==0?this.emptyMsg:String.format(this.displayMsg,D+1,D+C,A);this.displayEl.update(B)}},unbind:function(A){var B;var C;if(A instanceof Ext.grid.GridView){C=A}else{C=A.getView()}B=A.ds;B.un("loadexception",this.enableLoading,this);B.un("beforeload",this.disableLoading,this);B.un("load",this.enableLoading,this);C.un("rowremoved",this.onRowRemoved,this);C.un("rowsinserted",this.onRowsInserted,this);C.un("beforebuffer",this.beforeBuffer,this);C.un("cursormove",this.onCursorMove,this);C.un("buffer",this.onBuffer,this);C.un("bufferfailure",this.enableLoading,this);this.view=undefined},bind:function(A){this.view=A;var B=A.ds;B.on("loadexception",this.enableLoading,this);B.on("beforeload",this.disableLoading,this);B.on("load",this.enableLoading,this);A.on("rowremoved",this.onRowRemoved,this);A.on("rowsinserted",this.onRowsInserted,this);A.on("beforebuffer",this.beforeBuffer,this);A.on("cursormove",this.onCursorMove,this);A.on("buffer",this.onBuffer,this);A.on("bufferfailure",this.enableLoading,this)},enableLoading:function(){this.loading.setDisabled(false)},disableLoading:function(){this.loading.setDisabled(true)},onCursorMove:function(B,D,C,A){this.updateInfo(D,C,A)},onRowsInserted:function(B,C,A){this.updateInfo(B.rowIndex,Math.min(B.ds.totalLength,B.visibleRows-B.rowClipped),B.ds.totalLength)},onRowRemoved:function(B,C,A){this.updateInfo(B.rowIndex,Math.min(B.ds.totalLength,B.visibleRows-B.rowClipped),B.ds.totalLength)},beforeBuffer:function(B,C,F,E,A,D){this.loading.disable();this.updateInfo(F,E,A)},onBuffer:function(B,C,E,D,A){this.loading.enable();this.updateInfo(E,D,A)},onClick:function(A){switch(A){case"refresh":if(this.view.reset(true)){this.loading.disable()}else{this.loading.enable()}break}},onRender:function(B,A){Ext.PagingToolbar.superclass.onRender.call(this,B,A);this.loading=this.addButton({tooltip:this.refreshText,iconCls:"x-tbar-loading",handler:this.onClick.createDelegate(this,["refresh"])});this.addSeparator();if(this.displayInfo){this.displayEl=Ext.fly(this.el.dom).createChild({cls:"x-paging-info"})}}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.DragZone=function(B,A){Ext.ux.grid.livegrid.DragZone.superclass.constructor.call(this,B,A);this.view.ds.on("beforeselectionsload",this._onBeforeSelectionsLoad,this);this.view.ds.on("selectionsload",this._onSelectionsLoad,this)};Ext.extend(Ext.ux.grid.livegrid.DragZone,Ext.grid.GridDragZone,{isDropValid:true,onInitDrag:function(A){this.view.ds.loadSelections(this.grid.selModel.getPendingSelections(true));Ext.ux.grid.livegrid.DragZone.superclass.onInitDrag.call(this,A)},_onBeforeSelectionsLoad:function(){this.isDropValid=false;Ext.fly(this.proxy.el.dom.firstChild).addClass("ext-ux-livegrid-drop-waiting")},_onSelectionsLoad:function(){this.isDropValid=true;this.ddel.innerHTML=this.grid.getDragDropText();Ext.fly(this.proxy.el.dom.firstChild).removeClass("ext-ux-livegrid-drop-waiting")}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.EditorGridPanel=Ext.extend(Ext.grid.EditorGridPanel,{initEvents:function(){Ext.ux.grid.livegrid.EditorGridPanel.superclass.initEvents.call(this);this.view.on("cursormove",this.stopEditing,this,[true])},startEditing:function(B,A){this.stopEditing();if(this.colModel.isCellEditable(A,B)){this.view.ensureVisible(B,A,true);if(!this.store.getAt(B)){return }}return Ext.ux.grid.livegrid.EditorGridPanel.superclass.startEditing.call(this,B,A)},walkCells:function(E,A,D,C,B){return Ext.ux.grid.livegrid.GridPanel.prototype.walkCells.call(this,E,A,D,C,B)},onRender:function(B,A){return Ext.ux.grid.livegrid.GridPanel.prototype.onRender.call(this,B,A)}});1 Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.GridPanel=Ext.extend(Ext.grid.GridPanel,{initComponent:function(){if(this.cls){this.cls+=" ext-ux-livegrid"}else{this.cls="ext-ux-livegrid"}Ext.ux.grid.livegrid.GridPanel.superclass.initComponent.call(this)},onRender:function(B,A){Ext.ux.grid.livegrid.GridPanel.superclass.onRender.call(this,B,A);var C=this.getStore();if(C._autoLoad===true){delete C._autoLoad;C.load()}},walkCells:function(H,C,F,E,D){var G=this.store;var A=G.getCount;G.getCount=G.getTotalCount;var B=Ext.ux.grid.livegrid.GridPanel.superclass.walkCells.call(this,H,C,F,E,D);G.getCount=A;return B}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.GridView=function(A){this.addEvents({beforebuffer:true,buffer:true,bufferfailure:true,cursormove:true,abortrequest:true});this.horizontalScrollOffset=17;this._checkEmptyBody=true;Ext.apply(this,A);this.templates={};this.templates.master=new Ext.Template('<div class="x-grid3" hidefocus="true"><div class="liveScroller"><div></div></div>','<div class="x-grid3-viewport"">','<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset" style="{ostyle}">{header}</div></div><div class="x-clear"></div></div>','<div class="x-grid3-scroller" style="overflow-y:hidden !important;"><div class="x-grid3-body" style="{bstyle}">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',"</div>",'<div class="x-grid3-resize-marker"> </div>','<div class="x-grid3-resize-proxy"> </div>',"</div>");this._gridViewSuperclass=Ext.ux.grid.livegrid.GridView.superclass;this._gridViewSuperclass.constructor.call(this)};Ext.extend(Ext.ux.grid.livegrid.GridView,Ext.grid.GridView,{hdHeight:0,rowClipped:0,liveScroller:null,liveScrollerInset:null,rowHeight:-1,visibleRows:1,lastIndex:-1,lastRowIndex:0,lastScrollPos:0,rowIndex:0,isBuffering:false,requestQueue:-1,loadMask:false,loadMaskDisplayed:false,isPrebuffering:false,_loadMaskAnchor:null,reset:function(D){if(D===false){this.ds.modified=[];this.rowIndex=0;this.lastScrollPos=0;this.lastRowIndex=0;this.lastIndex=0;this.adjustVisibleRows();this.adjustScrollerPos(-this.liveScroller.dom.scrollTop,true);this.showLoadMask(false);var B=this.processRows;this.processRows=Ext.emptyFn;this.refresh(true);this.processRows=B;this.processRows(0);this.fireEvent("cursormove",this,0,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);return false}else{var C={};var A=this.ds.sortInfo;if(A){C={dir:A.direction,sort:A.field}}return this.ds.load({params:C})}},renderUI:function(){var A=this.grid;var C=A.enableDragDrop||A.enableDrag;A.enableDragDrop=false;A.enableDrag=false;this._gridViewSuperclass.renderUI.call(this);var A=this.grid;A.enableDragDrop=C;A.enableDrag=C;if(C){this.dragZone=new Ext.ux.grid.livegrid.DragZone(A,{ddGroup:A.ddGroup||"GridDD"})}if(this.loadMask){this._loadMaskAnchor=Ext.get(this.mainBody.dom.parentNode.parentNode);Ext.apply(this.loadMask,{msgCls:"x-mask-loading"});this._loadMaskAnchor.mask(this.loadMask.msg,this.loadMask.msgCls);var D=this._loadMaskAnchor.dom;var B=Ext.Element.data;B(D,"mask").addClass("ext-ux-livegrid");B(D,"mask").setDisplayed(false);B(D,"maskMsg").setDisplayed(false)}},init:function(A){this._gridViewSuperclass.init.call(this,A);A.on("expand",this._onExpand,this)},initData:function(B,A){if(this.ds){this.ds.un("bulkremove",this.onBulkRemove,this);this.ds.un("beforeload",this.onBeforeLoad,this)}if(B){B.on("bulkremove",this.onBulkRemove,this);B.on("beforeload",this.onBeforeLoad,this)}this._gridViewSuperclass.initData.call(this,B,A)},renderBody:function(){var A=this.renderRows(0,this.visibleRows-1);return this.templates.body.apply({rows:A})},doRender:function(C,B,E,A,D,F){return this._gridViewSuperclass.doRender.call(this,C,B,E,A+this.ds.bufferRange[0],D,F)},initElements:function(){var D=Ext.Element;var B=this.grid.getGridEl().dom.firstChild;var A=B.childNodes;this.el=new D(B);this.mainWrap=new D(A[1]);this.liveScroller=new D(A[0]);this.liveScrollerInset=this.liveScroller.dom.firstChild;this.liveScroller.on("scroll",this.onLiveScroll,this,{buffer:this.scrollDelay});var C=this.mainWrap.dom.firstChild;this.mainHd=new D(C);this.hdHeight=C.offsetHeight;this.innerHd=this.mainHd.dom.firstChild;this.scroller=new D(this.mainWrap.dom.childNodes[1]);if(this.forceFit){this.scroller.setStyle("overflow-x","hidden")}this.mainBody=new D(this.scroller.dom.firstChild);this.mainBody.on("mousewheel",this.handleWheel,this);this.focusEl=new D(this.scroller.dom.childNodes[1]);this.focusEl.swallowEvent("click",true);this.resizeMarker=new D(A[2]);this.resizeProxy=new D(A[3])},layout:function(){if(!this.mainBody){return }var E=this.grid;var G=E.getGridEl(),I=this.cm,B=E.autoExpandColumn,A=this;var C=G.getSize(true);var H=C.width;if(!E.hideHeaders&&H<20||C.height<20){return }if(E.autoHeight){this.scroller.dom.style.overflow="visible";if(Ext.isWebKit){this.scroller.dom.style.position="static"}}else{this.el.setSize(C.width,C.height);var F=this.mainHd.getHeight();var D=C.height-(F);this.scroller.setSize(H,D);if(this.innerHd){this.innerHd.style.width=(H)+"px"}}this.liveScroller.dom.style.top=this.hdHeight+"px";if(this.forceFit){if(this.lastViewWidth!=H){this.fitColumns(false,false);this.lastViewWidth=H}}else{this.autoExpand()}this.adjustVisibleRows();this.adjustBufferInset();this.onLayout(H,D)},removeRow:function(A){Ext.removeNode(this.getRow(A))},removeRows:function(C,A){var B=this.mainBody.dom;for(var D=C;D<=A;D++){Ext.removeNode(B.childNodes[C])}},_onExpand:function(A){this.adjustVisibleRows();this.adjustBufferInset();this.adjustScrollerPos(this.rowHeight*this.rowIndex,true)},onColumnMove:function(A,C,B){this.indexMap=null;this.replaceLiveRows(this.rowIndex,true);this.updateHeaders();this.updateHeaderSortState();this.afterMove(B);this.grid.fireEvent("columnmove",C,B)},onColumnWidthUpdated:function(C,A,B){this.adjustVisibleRows();this.adjustBufferInset()},onAllColumnWidthsUpdated:function(A,B){this.adjustVisibleRows();this.adjustBufferInset()},onRowSelect:function(A){if(A<this.rowIndex||A>this.rowIndex+this.visibleRows){return }this.addRowClass(A,this.selectedRowClass)},onRowDeselect:function(A){if(A<this.rowIndex||A>this.rowIndex+this.visibleRows){return }this.removeRowClass(A,this.selectedRowClass)},onClear:function(){this.reset(false)},onBulkRemove:function(L,M){var H=null;var J=0;var O=0;var K=M.length;var A=false;var I=false;var F=0;if(K==0){return }var C=this.rowIndex;var B=0;var E=0;var D=0;for(var G=0;G<K;G++){H=M[G][0];J=M[G][1];O=(J!=Number.MIN_VALUE&&J!=Number.MAX_VALUE)?J+this.ds.bufferRange[0]:J;if(O<this.rowIndex){B++}else{if(O>=this.rowIndex&&O<=this.rowIndex+(this.visibleRows-1)){D++}else{if(O>=this.rowIndex+this.visibleRows){E++}}}this.fireEvent("beforerowremoved",this,O,H);this.fireEvent("rowremoved",this,O,H)}var N=this.ds.totalLength;this.rowIndex=Math.max(0,Math.min(this.rowIndex-B,N-(this.visibleRows-1)));this.lastRowIndex=this.rowIndex;this.adjustScrollerPos(-(B*this.rowHeight),true);this.updateLiveRows(this.rowIndex,true);this.adjustBufferInset();this.processRows(0,undefined,false)},onRemove:function(C,A,B){this.onBulkRemove(C,[[A,B]])},onAdd:function(B,C,G){if(this._checkEmptyBody){if(this.mainBody.dom.innerHTML==" "){this.mainBody.dom.innerHTML=""}this._checkEmptyBody=false}var F=C.length;if(G==Number.MAX_VALUE||G==Number.MIN_VALUE){this.fireEvent("beforerowsinserted",this,G,G);if(G==Number.MIN_VALUE){this.rowIndex=this.rowIndex+F;this.lastRowIndex=this.rowIndex;this.adjustBufferInset();this.adjustScrollerPos(this.rowHeight*F,true);this.fireEvent("rowsinserted",this,G,G,F);this.processRows(0,undefined,false);this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);return }this.adjustBufferInset();this.fireEvent("rowsinserted",this,G,G,F);return }var A=G+this.ds.bufferRange[0];var E=A+(F-1);var H=this.getRows().length;var D=0;var I=0;if(A>this.rowIndex+(this.visibleRows-1)){this.fireEvent("beforerowsinserted",this,A,E);this.fireEvent("rowsinserted",this,A,E,F);this.adjustVisibleRows();this.adjustBufferInset()}else{if(A>=this.rowIndex&&A<=this.rowIndex+(this.visibleRows-1)){D=G;I=G+(F-1);this.lastRowIndex=this.rowIndex;this.rowIndex=(A>this.rowIndex)?this.rowIndex:A;this.insertRows(B,D,I);if(this.lastRowIndex!=this.rowIndex){this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength)}this.adjustVisibleRows();this.adjustBufferInset()}else{if(A<this.rowIndex){this.fireEvent("beforerowsinserted",this,A,E);this.rowIndex=this.rowIndex+F;this.lastRowIndex=this.rowIndex;this.adjustVisibleRows();this.adjustBufferInset();this.adjustScrollerPos(this.rowHeight*F,true);this.fireEvent("rowsinserted",this,A,E,F);this.processRows(0,undefined,true);this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength)}}}},onBeforeLoad:function(B,C){var D=B.proxy;if(D.activeRequest&&D.activeRequest[Ext.data.Api.actions.read]){D.getConnection().abort(D.activeRequest[Ext.data.Api.actions.read])}this.fireEvent("abortrequest",B,C);this.isBuffering=false;this.isPreBuffering=false;C.params=C.params||{};var A=Ext.apply;A(C,{scope:this,callback:function(){this.reset(false)},suspendLoadEvent:false});A(C.params,{start:0,limit:this.ds.bufferSize});return true},onLoad:function(C,B,A){this.adjustBufferInset()},onDataChange:function(A){this.updateHeaderSortState()},liveBufferUpdate:function(A,B,D){if(D===true){this.adjustBufferInset();this.fireEvent("buffer",this,this.ds,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength,B);this.grid.selModel.replaceSelections(A);this.isBuffering=false;this.isPrebuffering=false;this.showLoadMask(false);if(this.requestQueue>=0){var C=this.requestQueue;this.requestQueue=-1;this.updateLiveRows(C);return }if(this.isInRange(this.rowIndex)){this.replaceLiveRows(this.rowIndex,B.forceRepaint)}else{this.updateLiveRows(this.rowIndex)}return }else{this.fireEvent("bufferfailure",this,this.ds,B)}this.requestQueue=-1;this.isBuffering=false;this.isPrebuffering=false;this.showLoadMask(false)},handleWheel:function(A){if(this.rowHeight==-1){A.stopEvent();return }var B=A.getWheelDelta();this.adjustScrollerPos(-(B*this.rowHeight));A.stopEvent()},onLiveScroll:function(){var A=this.liveScroller.dom.scrollTop;var B=Math.floor((A)/this.rowHeight);this.rowIndex=B;if(B==this.lastRowIndex){return }this.updateLiveRows(B);this.lastScrollPos=this.liveScroller.dom.scrollTop},refreshRow:function(A){var D=this.ds,C;if(typeof A=="number"){C=A;A=D.getAt(C)}else{C=D.indexOf(A)}var B=C+this.ds.bufferRange[0];if(B<this.rowIndex||B>=this.rowIndex+this.visibleRows){this.fireEvent("rowupdated",this,B,A);return }this.insertRows(D,C,C,true);this.fireEvent("rowupdated",this,B,A)},processRows:function(F,D,A){if(!this.ds||this.ds.getCount()<1){return }D=D||!this.grid.stripeRows;var G=this.rowIndex;var I=this.getRows();var C=0;var H=null;for(var E=0,B=I.length;E<B;E++){H=I[E];H.rowIndex=C=G+E;H.className=H.className.replace(this.rowClsRe," ");if(!D&&(C+1)%2===0){H.className+=" x-grid3-row-alt"}if(A!==false){if(this.grid.selModel.isSelected(this.ds.getAt(C))===true){this.addRowClass(C,this.selectedRowClass)}else{this.removeRowClass(C,this.selectedRowClass)}this.fly(H).removeClass("x-grid3-row-over")}}if(G===0){Ext.fly(I[0]).addClass(this.firstRowCls)}else{if(G+I.length==this.ds.totalLength){Ext.fly(I[I.length-1]).addClass(this.lastRowCls)}}},insertRows:function(E,B,M,L){var A=B+this.ds.bufferRange[0];var F=M+this.ds.bufferRange[0];if(!L){this.fireEvent("beforerowsinserted",this,A,F)}if(L!==true&&(this.getRows().length+(M-B))>=this.visibleRows){this.removeRows((this.visibleRows-1)-(M-B),this.visibleRows-1)}else{if(L){this.removeRows(A-this.rowIndex,F-this.rowIndex)}}var G=(B==M)?M:Math.min(M,(this.rowIndex-this.ds.bufferRange[0])+(this.visibleRows-1));var D=this.renderRows(B,G);var I=this.getRow(A);if(I){Ext.DomHelper.insertHtml("beforeBegin",I,D)}else{Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,D)}if(L===true){var K=this.getRows();var J=this.rowIndex;for(var C=0,H=K.length;C<H;C++){K[C].rowIndex=J+C}}if(!L){this.fireEvent("rowsinserted",this,A,F,(F-A)+1);this.processRows(0,undefined,true)}},getRow:function(A){if(A-this.rowIndex<0){return null}return this.getRows()[A-this.rowIndex]},getCell:function(B,A){var B=this.getRow(B);return B?B.getElementsByTagName("td")[A]:null},focusCell:function(D,A,C){var B=this.ensureVisible(D,A,C);if(!B){return }this.focusEl.setXY(B);if(Ext.isGecko){this.focusEl.focus()}else{this.focusEl.focus.defer(1,this.focusEl)}},ensureVisible:function(K,C,B){if(typeof K!="number"){K=K.rowIndex}if(K<0||K>=this.ds.totalLength){return }C=(C!==undefined?C:0);var H=K-this.rowIndex;if(this.rowClipped&&K==this.rowIndex+this.visibleRows-1){this.adjustScrollerPos(this.rowHeight)}else{if(K>=this.rowIndex+this.visibleRows){this.adjustScrollerPos(((K-(this.rowIndex+this.visibleRows))+1)*this.rowHeight)}else{if(K<=this.rowIndex){this.adjustScrollerPos((H)*this.rowHeight)}}}var G=this.getRow(K),D;if(!G){return }if(!(B===false&&C===0)){while(this.cm.isHidden(C)){C++}D=this.getCell(K,C)}var J=this.scroller.dom;if(B!==false){var I=parseInt(D.offsetLeft,10);var F=I+D.offsetWidth;var E=parseInt(J.scrollLeft,10);var A=E+J.clientWidth;if(I<E){J.scrollLeft=I}else{if(F>A){J.scrollLeft=F-J.clientWidth}}}return D?Ext.fly(D).getXY():[J.scrollLeft+this.el.getX(),Ext.fly(G).getY()]},isRecordRendered:function(A){var B=this.ds.indexOf(A);if(B>=this.rowIndex&&B<this.rowIndex+this.visibleRows){return true}return false},isInRange:function(B){var A=Math.min(this.ds.totalLength-1,B+(this.visibleRows-1));return(B>=this.ds.bufferRange[0])&&(A<=this.ds.bufferRange[1])},getPredictedBufferIndex:function(A,B,C){if(!B){if(A+this.ds.bufferSize>=this.ds.totalLength){return this.ds.totalLength-this.ds.bufferSize}return Math.max(0,(A+this.visibleRows)-Math.round(this.ds.bufferSize/2))}if(!C){return Math.max(0,(A-this.ds.bufferSize)+this.visibleRows)}if(C){return Math.max(0,Math.min(A,this.ds.totalLength-this.ds.bufferSize))}},updateLiveRows:function(G,H,D){var J=this.isInRange(G);if(this.isBuffering){if(this.isPrebuffering){if(J){this.replaceLiveRows(G,H)}else{this.showLoadMask(true)}}this.fireEvent("cursormove",this,G,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);this.requestQueue=G;return }var E=this.lastIndex;this.lastIndex=G;var J=this.isInRange(G);var I=false;if(J&&D!==true){this.replaceLiveRows(G,H);this.fireEvent("cursormove",this,G,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);if(G>E){I=true;var K=this.ds.totalLength;if(G+this.visibleRows+this.nearLimit<=this.ds.bufferRange[1]){return }if(this.ds.bufferRange[1]+1>=K){return }}else{if(G<E){I=false;if(this.ds.bufferRange[0]<=0){return }if(G-this.nearLimit>this.ds.bufferRange[0]){return }}else{return }}this.isPrebuffering=true}this.isBuffering=true;var B=this.getPredictedBufferIndex(G,J,I);if(!J){this.showLoadMask(true)}this.ds.suspendEvents();var F=this.ds.sortInfo;var C={};if(this.ds.lastOptions){Ext.apply(C,this.ds.lastOptions.params)}C.start=B;C.limit=this.ds.bufferSize;if(F){C.dir=F.direction;C.sort=F.field}var A={forceRepaint:H,callback:this.liveBufferUpdate,scope:this,params:C,suspendLoadEvent:true};this.fireEvent("beforebuffer",this,this.ds,G,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength,A);this.ds.load(A);this.ds.resumeEvents()},showLoadMask:function(B){if(!this.loadMask||B==this.loadMaskDisplayed){return }var E=this._loadMaskAnchor.dom;var D=Ext.Element.data;var A=D(E,"mask");var C=D(E,"maskMsg");if(B){A.setDisplayed(true);C.setDisplayed(true);C.center(this._loadMaskAnchor);if(Ext.isIE&&!(Ext.isIE7&&Ext.isStrict)&&this._loadMaskAnchor.getStyle("height")=="auto"){A.setSize(undefined,this._loadMaskAnchor.getHeight())}}else{A.setDisplayed(false);C.setDisplayed(false)}this.loadMaskDisplayed=B},replaceLiveRows:function(H,G,C){var D=H-this.lastRowIndex;if(D==0&&G!==true){return }var A=D>0;D=Math.abs(D);var B=this.ds.bufferRange;var I=H-B[0];var E=Math.min(I+this.visibleRows-1,B[1]-B[0]);if(D>=this.visibleRows||D==0){this.mainBody.update(this.renderRows(I,E))}else{if(A){this.removeRows(0,D-1);if(I+this.visibleRows-D<=B[1]-B[0]){var F=this.renderRows(I+this.visibleRows-D,E);Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,F)}}else{this.removeRows(this.visibleRows-D,this.visibleRows-1);var F=this.renderRows(I,I+D-1);Ext.DomHelper.insertHtml("beforeBegin",this.mainBody.dom.firstChild,F)}}if(C!==false){this.processRows(0,undefined,true)}this.lastRowIndex=H},adjustBufferInset:function(){var B=this.liveScroller.dom;var D=this.grid,E=D.store;var H=D.getGridEl();var C=H.getSize().width;var F=(E.totalLength==this.visibleRows-this.rowClipped)?0:Math.max(0,E.totalLength-(this.visibleRows-this.rowClipped));if(F==0){this.scroller.setWidth(C);B.style.display="none";return }else{this.scroller.setWidth(C-this.getScrollOffset());B.style.display=""}var G=this.cm.getTotalWidth()+this.getScrollOffset()>C;var A=B.parentNode.offsetHeight+((E.totalLength>0&&G)?-this.horizontalScrollOffset:0)-this.hdHeight;B.style.height=Math.max(A,this.horizontalScrollOffset*2)+"px";if(this.rowHeight==-1){return }this.liveScrollerInset.style.height=(F==0?0:A+(F*this.rowHeight))+"px"},adjustVisibleRows:function(){if(this.rowHeight==-1){if(this.getRows()[0]){this.rowHeight=this.getRows()[0].offsetHeight;if(this.rowHeight<=0){this.rowHeight=-1;return }}else{return }}var E=this.grid,C=E.store;var F=E.getGridEl();var H=this.cm;var J=F.getSize();var B=J.width;var D=J.height;var G=B-this.getScrollOffset();if(H.getTotalWidth()>G){D-=this.horizontalScrollOffset}D-=this.mainHd.getHeight();var I=C.totalLength||0;var A=Math.max(1,Math.floor(D/this.rowHeight));this.rowClipped=0;if(I>A&&this.rowHeight/3<(D-(A*this.rowHeight))){A=Math.min(A+1,I);this.rowClipped=1}if(this.visibleRows==A){return }this.visibleRows=A;if(this.isBuffering&&!this.isPrebuffering){return }if(this.rowIndex+(A-this.rowClipped)>I){this.rowIndex=Math.max(0,I-(A-this.rowClipped));this.lastRowIndex=this.rowIndex}this.updateLiveRows(this.rowIndex,true)},adjustScrollerPos:function(D,A){if(D==0){return }var C=this.liveScroller;var B=C.dom;if(A===true){C.un("scroll",this.onLiveScroll,this)}this.lastScrollPos=B.scrollTop;B.scrollTop+=D;if(A===true){B.scrollTop=B.scrollTop;C.on("scroll",this.onLiveScroll,this,{buffer:this.scrollDelay})}}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.JsonReader=function(A,B){Ext.ux.grid.livegrid.JsonReader.superclass.constructor.call(this,A,B)};Ext.extend(Ext.ux.grid.livegrid.JsonReader,Ext.data.JsonReader,{buildExtractors:function(){if(this.ef){return }var A=this.meta;if(A.versionProperty){this.getVersion=this.createAccessor(A.versionProperty)}Ext.ux.grid.livegrid.JsonReader.superclass.buildExtractors.call(this)},readRecords:function(C){if(!this.__readRecords){this.__readRecords=Ext.ux.grid.livegrid.JsonReader.superclass.readRecords}var B=this.__readRecords.call(this,C);if(this.meta.versionProperty){var A=this.getVersion(C);B.version=(A===undefined||A==="")?null:A}return B}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.RowSelectionModel=function(A){this.addEvents({selectiondirty:true});Ext.apply(this,A);this.pendingSelections={};Ext.ux.grid.livegrid.RowSelectionModel.superclass.constructor.call(this)};Ext.extend(Ext.ux.grid.livegrid.RowSelectionModel,Ext.grid.RowSelectionModel,{initEvents:function(){Ext.ux.grid.livegrid.RowSelectionModel.superclass.initEvents.call(this);this.grid.view.on("rowsinserted",this.onAdd,this);this.grid.store.on("selectionsload",this.onSelectionsLoad,this)},onRemove:function(B,D,G){var A=this.getPendingSelections();var C=A.length;var F=false;if(D==Number.MIN_VALUE||D==Number.MAX_VALUE){if(G){if(this.isIdSelected(G.id)&&D==Number.MIN_VALUE){this.shiftSelections(this.grid.store.bufferRange[1],-1)}this.selections.remove(G);F=true}if(D==Number.MIN_VALUE){this.clearPendingSelections(0,this.grid.store.bufferRange[0])}else{this.clearPendingSelections(this.grid.store.bufferRange[1])}if(C!=0){this.fireEvent("selectiondirty",this,D,1)}}else{F=this.isIdSelected(G.id);if(!F){return }this.selections.remove(G);if(C!=0){var H=A[0];var E=A[C-1];if(D<=E||D<=H){this.shiftSelections(D,-1);this.fireEvent("selectiondirty",this,D,1)}}}if(F){this.fireEvent("selectionchange",this)}},onAdd:function(G,E,D,B){var A=this.getPendingSelections();var H=A.length;if((E==Number.MIN_VALUE||E==Number.MAX_VALUE)){if(E==Number.MIN_VALUE){this.clearPendingSelections(0,this.grid.store.bufferRange[0]);this.shiftSelections(this.grid.store.bufferRange[1],B)}else{this.clearPendingSelections(this.grid.store.bufferRange[1])}if(H!=0){this.fireEvent("selectiondirty",this,E,r)}return }var F=A[0];var C=A[H-1];var I=E;if(I<=C||I<=F){this.fireEvent("selectiondirty",this,I,B);this.shiftSelections(I,B)}},shiftSelections:function(L,C){var H=0;var K=0;var B={};var D=this.grid.store;var I=L-D.bufferRange[0];var F=0;var M=this.grid.store.totalLength;var E=null;var A=this.getPendingSelections();var J=A.length;if(J==0){return }for(var G=0;G<J;G++){H=A[G];if(H<L){continue}K=H+C;F=I+C;if(K>=M){break}E=D.getAt(F);if(E){this.selections.add(E)}else{B[K]=true}}this.pendingSelections=B},onSelectionsLoad:function(C,B,A){this.replaceSelections(B)},hasNext:function(){return this.last!==false&&(this.last+1)<this.grid.store.getTotalCount()},getCount:function(){return this.selections.length+this.getPendingSelections().length},isSelected:function(A){if(typeof A=="number"){var B=A;A=this.grid.store.getAt(B);if(!A){var D=this.getPendingSelections().indexOf(B);if(D!=-1){return true}return false}}var C=A;return(C&&this.selections.key(C.id)?true:false)},deselectRecord:function(A,C){if(this.locked){return }var E=this.selections.key(A.id);if(!E){return }var B=this.grid.store;var D=B.indexOfId(A.id);if(D==-1){D=B.findInsertIndex(A);if(D!=Number.MIN_VALUE&&D!=Number.MAX_VALUE){D+=B.bufferRange[0]}}else{delete this.pendingSelections[D]}if(this.last==D){this.last=false}if(this.lastActive==D){this.lastActive=false}this.selections.remove(A);if(!C){this.grid.getView().onRowDeselect(D)}this.fireEvent("rowdeselect",this,D,A);this.fireEvent("selectionchange",this)},deselectRow:function(B,A){if(this.locked){return }if(this.last==B){this.last=false}if(this.lastActive==B){this.lastActive=false}var C=this.grid.store.getAt(B);delete this.pendingSelections[B];if(C){this.selections.remove(C)}if(!A){this.grid.getView().onRowDeselect(B)}this.fireEvent("rowdeselect",this,B,C);this.fireEvent("selectionchange",this)},selectRow:function(B,D,A){if(this.locked||B<0||B>=this.grid.store.getTotalCount()){return }var C=this.grid.store.getAt(B);if(this.fireEvent("beforerowselect",this,B,D,C)!==false){if(!D||this.singleSelect){this.clearSelections()}if(C){this.selections.add(C);delete this.pendingSelections[B]}else{this.pendingSelections[B]=true}this.last=this.lastActive=B;if(!A){this.grid.getView().onRowSelect(B)}this.fireEvent("rowselect",this,B,C);this.fireEvent("selectionchange",this)}},clearPendingSelections:function(G,F){if(F==undefined){F=Number.MAX_VALUE}var B={};var A=this.getPendingSelections();var D=A.length;var C=0;for(var E=0;E<D;E++){C=A[E];if(C<=F&&C>=G){continue}B[C]=true}this.pendingSelections=B},replaceSelections:function(E){if(!E||E.length==0){return }var D=this.grid.store;var F=null;var I=[];var A=this.getPendingSelections();var J=A.length;var C=this.selections;var H=0;for(var G=0;G<J;G++){H=A[G];F=D.getAt(H);if(F){C.add(F);I.push(F.id);delete this.pendingSelections[H]}}var B=null;for(G=0,len=E.length;G<len;G++){F=E[G];B=F.id;if(I.indexOf(B)==-1&&C.containsKey(B)){C.add(F)}}},getPendingSelections:function(F){var D=1;var C=[];var B=0;var G=[];for(var E in this.pendingSelections){G.push(parseInt(E))}G.sort(function(I,H){if(I>H){return 1}else{if(I<H){return -1}else{return 0}}});if(!F){return G}var A=G.length;if(A==0){return[]}C[B]=[G[0],G[0]];for(var E=0,A=A-1;E<A;E++){if(G[E+1]-G[E]==1){C[B][1]=G[E+1]}else{B++;C[B]=[G[E+1],G[E+1]]}}return C},clearSelections:function(A){if(this.locked){return }if(A!==true){var D=this.grid.store;var B=this.selections;var C=-1;B.each(function(E){C=D.indexOfId(E.id);if(C!=-1){this.deselectRow(C+D.bufferRange[0])}},this);B.clear();this.pendingSelections={}}else{this.selections.clear();this.pendingSelections={}}this.last=false},selectRange:function(B,A,D){if(this.locked){return }if(!D){this.clearSelections()}if(B<=A){for(var C=B;C<=A;C++){this.selectRow(C,true)}}else{for(var C=B;C>=A;C--){this.selectRow(C,true)}}}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.Store=function(A){A=A||{};A.remoteSort=true;this._autoLoad=A.autoLoad?true:false;A.autoLoad=false;this.addEvents("bulkremove","versionchange","beforeselectionsload","selectionsload");Ext.ux.grid.livegrid.Store.superclass.constructor.call(this,A);this.totalLength=0;this.bufferRange=[-1,-1];this.on("clear",function(){this.bufferRange=[-1,-1]},this);if(this.url&&!this.selectionsProxy){this.selectionsProxy=new Ext.data.HttpProxy({url:this.url})}};Ext.extend(Ext.ux.grid.livegrid.Store,Ext.data.Store,{version:null,insert:function(D,C){C=[].concat(C);D=D>=this.bufferSize?Number.MAX_VALUE:D;if(D==Number.MIN_VALUE||D==Number.MAX_VALUE){var B=C.length;if(D==Number.MIN_VALUE){this.bufferRange[0]+=B;this.bufferRange[1]+=B}this.totalLength+=B;this.fireEvent("add",this,C,D);return }var F=false;var G=C;if(C.length+D>=this.bufferSize){F=true;G=C.splice(0,this.bufferSize-D)}this.totalLength+=G.length;if(this.bufferRange[0]<=-1){this.bufferRange[0]=0}if(this.bufferRange[1]<(this.bufferSize-1)){this.bufferRange[1]=Math.min(this.bufferRange[1]+G.length,this.bufferSize-1)}for(var E=0,A=G.length;E<A;E++){this.data.insert(D,G[E]);G[E].join(this)}while(this.getCount()>this.bufferSize){this.data.remove(this.data.last())}this.fireEvent("add",this,G,D);if(F==true){this.fireEvent("add",this,C,Number.MAX_VALUE)}},remove:function(B,A){var C=this._getIndex(B);if(C<0){this.totalLength-=1;if(this.pruneModifiedRecords){this.modified.remove(B)}this.bufferRange[0]=Math.max(-1,this.bufferRange[0]-1);this.bufferRange[1]=Math.max(-1,this.bufferRange[1]-1);if(A!==true){this.fireEvent("remove",this,B,C)}return C}this.bufferRange[1]=Math.max(-1,this.bufferRange[1]-1);this.data.removeAt(C);if(this.pruneModifiedRecords){this.modified.remove(B)}this.totalLength-=1;if(A!==true){this.fireEvent("remove",this,B,C)}return C},_getIndex:function(A){var B=this.indexOfId(A.id);if(B<0){B=this.findInsertIndex(A)}return B},bulkRemove:function(B){var G=null;var E=[];var D=0;var A=B.length;var F=[];for(var C=0;C<A;C++){G=B[C];F[G.id]=this._getIndex(G)}for(var C=0;C<A;C++){G=B[C];this.remove(G,true);E.push([G,F[G.id]])}this.fireEvent("bulkremove",this,E)},removeAll:function(){this.totalLength=0;this.bufferRange=[-1,-1];this.data.clear();if(this.pruneModifiedRecords){this.modified=[]}this.fireEvent("clear",this)},loadRanges:function(B){var A=B.length;if(A>0&&!this.selectionsProxy.activeRequest[Ext.data.Api.actions.read]&&this.fireEvent("beforeselectionsload",this,B)!==false){var E=this.lastOptions.params;var F={};F.ranges=Ext.encode(B);if(E){if(E.sort){F.sort=E.sort}if(E.dir){F.dir=E.dir}}var C={};for(var D in this.lastOptions){C.i=this.lastOptions.i}C.ranges=F.ranges;this.selectionsProxy.load(F,this.reader,this.selectionsLoaded,this,C)}},loadSelections:function(A){if(A.length==0){return }this.loadRanges(A)},selectionsLoaded:function(F,B,E){if(this.checkVersionChange(F,B,E)!==false){var D=F.records;for(var C=0,A=D.length;C<A;C++){D[C].join(this)}this.fireEvent("selectionsload",this,F.records,Ext.decode(B.ranges))}else{this.fireEvent("selectionsload",this,[],Ext.decode(B.ranges))}},checkVersionChange:function(D,B,C){if(D&&C!==false){if(D.version!==undefined){var A=this.version;this.version=D.version;if(this.version!==A){return this.fireEvent("versionchange",this,A,this.version)}}}},findInsertIndex:function(A){this.remoteSort=false;var B=Ext.ux.grid.livegrid.Store.superclass.findInsertIndex.call(this,A);this.remoteSort=true;if(this.bufferRange[0]<=0&&B==0){return B}else{if(this.bufferRange[0]>0&&B==0){return Number.MIN_VALUE}else{if(B>=this.bufferSize){return Number.MAX_VALUE}}}return B},sortData:function(C,D){D=D||"ASC";var A=this.fields.get(C).sortType;var B=function(F,E){var H=A(F.data[C]),G=A(E.data[C]);return H>G?1:(H<G?-1:0)};this.data.sort(D,B)},onMetaChange:function(B,A,C){this.version=null;Ext.ux.grid.livegrid.Store.superclass.onMetaChange.call(this,B,A,C)},loadRecords:function(C,A,B){this.checkVersionChange(C,A,B);if(!C){this.bufferRange=[-1,-1]}else{this.bufferRange=[A.params.start,Math.max(0,Math.min((A.params.start+A.params.limit)-1,C.totalRecords-1))]}if(A.suspendLoadEvent===true){this.suspendEvents()}Ext.ux.grid.livegrid.Store.superclass.loadRecords.call(this,C,A,B);if(A.suspendLoadEvent===true){this.resumeEvents()}},getAt:function(A){if(this.bufferRange[0]==-1){return undefined}var B=A-this.bufferRange[0];return this.data.itemAt(B)},clearFilter:function(){},isFiltered:function(){},collect:function(){},createFilterFn:function(){},sum:function(){},filter:function(){},filterBy:function(){},query:function(){},queryBy:function(){},find:function(){},findBy:function(){}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.Toolbar=Ext.extend(Ext.Toolbar,{displayMsg:"Displaying {0} - {1} of {2}",emptyMsg:"No data to display",refreshText:"Refresh",initComponent:function(){Ext.ux.grid.livegrid.Toolbar.superclass.initComponent.call(this);if(this.grid){this.view=this.grid.getView()}var A=this;this.view.init=this.view.init.createSequence(function(){A.bind(this)},this.view)},updateInfo:function(D,C,A){if(this.displayEl){var B=A==0?this.emptyMsg:String.format(this.displayMsg,D+1,D+C,A);this.displayEl.update(B)}},unbind:function(A){var B;var C;if(A instanceof Ext.grid.GridView){C=A}else{C=A.getView()}B=A.ds;B.un("loadexception",this.enableLoading,this);B.un("beforeload",this.disableLoading,this);B.un("load",this.enableLoading,this);C.un("rowremoved",this.onRowRemoved,this);C.un("rowsinserted",this.onRowsInserted,this);C.un("beforebuffer",this.beforeBuffer,this);C.un("cursormove",this.onCursorMove,this);C.un("buffer",this.onBuffer,this);C.un("bufferfailure",this.enableLoading,this);this.view=undefined},bind:function(A){this.view=A;var B=A.ds;B.on("loadexception",this.enableLoading,this);B.on("beforeload",this.disableLoading,this);B.on("load",this.enableLoading,this);A.on("rowremoved",this.onRowRemoved,this);A.on("rowsinserted",this.onRowsInserted,this);A.on("beforebuffer",this.beforeBuffer,this);A.on("cursormove",this.onCursorMove,this);A.on("buffer",this.onBuffer,this);A.on("bufferfailure",this.enableLoading,this)},enableLoading:function(){this.loading.setDisabled(false)},disableLoading:function(){this.loading.setDisabled(true)},onCursorMove:function(B,D,C,A){this.updateInfo(D,C,A)},onRowsInserted:function(B,C,A){this.updateInfo(B.rowIndex,Math.min(B.ds.totalLength,B.visibleRows-B.rowClipped),B.ds.totalLength)},onRowRemoved:function(B,C,A){this.updateInfo(B.rowIndex,Math.min(B.ds.totalLength,B.visibleRows-B.rowClipped),B.ds.totalLength)},beforeBuffer:function(B,C,F,E,A,D){this.loading.disable();this.updateInfo(F,E,A)},onBuffer:function(B,C,E,D,A){this.loading.enable();this.updateInfo(E,D,A)},onClick:function(A){switch(A){case"refresh":if(this.view.reset(true)){this.loading.disable()}else{this.loading.enable()}break}},onRender:function(B,A){Ext.PagingToolbar.superclass.onRender.call(this,B,A);this.loading=new Ext.Toolbar.Button({tooltip:this.refreshText,iconCls:"x-tbar-loading",handler:this.onClick.createDelegate(this,["refresh"])});this.addButton(this.loading);this.addSeparator();if(this.displayInfo){this.displayEl=Ext.fly(this.el.dom).createChild({cls:"x-paging-info"})}}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.DragZone=function(B,A){Ext.ux.grid.livegrid.DragZone.superclass.constructor.call(this,B,A);this.view.ds.on("beforeselectionsload",this._onBeforeSelectionsLoad,this);this.view.ds.on("selectionsload",this._onSelectionsLoad,this)};Ext.extend(Ext.ux.grid.livegrid.DragZone,Ext.grid.GridDragZone,{isDropValid:true,onInitDrag:function(A){this.view.ds.loadSelections(this.grid.selModel.getPendingSelections(true));Ext.ux.grid.livegrid.DragZone.superclass.onInitDrag.call(this,A)},_onBeforeSelectionsLoad:function(){this.isDropValid=false;Ext.fly(this.proxy.el.dom.firstChild).addClass("ext-ux-livegrid-drop-waiting")},_onSelectionsLoad:function(){this.isDropValid=true;this.ddel.innerHTML=this.grid.getDragDropText();Ext.fly(this.proxy.el.dom.firstChild).removeClass("ext-ux-livegrid-drop-waiting")}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.EditorGridPanel=Ext.extend(Ext.grid.EditorGridPanel,{initEvents:function(){Ext.ux.grid.livegrid.EditorGridPanel.superclass.initEvents.call(this);this.view.on("cursormove",this.stopEditing,this,[true])},startEditing:function(B,A){this.stopEditing();if(this.colModel.isCellEditable(A,B)){this.view.ensureVisible(B,A,true);if(!this.store.getAt(B)){return }}return Ext.ux.grid.livegrid.EditorGridPanel.superclass.startEditing.call(this,B,A)},walkCells:function(E,A,D,C,B){return Ext.ux.grid.livegrid.GridPanel.prototype.walkCells.call(this,E,A,D,C,B)},onRender:function(B,A){return Ext.ux.grid.livegrid.GridPanel.prototype.onRender.call(this,B,A)},initComponent:function(){if(this.cls){this.cls+=" ext-ux-livegrid"}else{this.cls="ext-ux-livegrid"}return Ext.ux.grid.livegrid.EditorGridPanel.superclass.initComponent.call(this)}}); -
trunk/build/livegrid-core.js
r60 r68 1 Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.GridPanel=Ext.extend(Ext.grid.GridPanel,{ onRender:function(B,A){Ext.ux.grid.livegrid.GridPanel.superclass.onRender.call(this,B,A);var C=this.getStore();if(C._autoLoad===true){delete C._autoLoad;C.load()}},walkCells:function(H,C,F,E,D){var G=this.store;var A=G.getCount;G.getCount=G.getTotalCount;var B=Ext.ux.grid.livegrid.GridPanel.superclass.walkCells.call(this,H,C,F,E,D);G.getCount=A;return B}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.GridView=function(A){this.addEvents({beforebuffer:true,buffer:true,bufferfailure:true,cursormove:true});this.horizontalScrollOffset=17;Ext.apply(this,A);this.templates={};this.templates.master=new Ext.Template('<div class="x-grid3" hidefocus="true"><div class="ext-ux-livegrid-liveScroller"><div></div></div>','<div class="x-grid3-viewport"">','<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset">{header}</div></div><div class="x-clear"></div></div>','<div class="x-grid3-scroller" style="overflow-y:hidden !important;"><div class="x-grid3-body">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',"</div>",'<div class="x-grid3-resize-marker"> </div>','<div class="x-grid3-resize-proxy"> </div>',"</div>");this._gridViewSuperclass=Ext.ux.grid.livegrid.GridView.superclass;this._gridViewSuperclass.constructor.call(this)};Ext.extend(Ext.ux.grid.livegrid.GridView,Ext.grid.GridView,{_maskIndex:20001,hdHeight:0,rowClipped:0,liveScroller:null,liveScrollerInset:null,rowHeight:-1,visibleRows:1,lastIndex:-1,lastRowIndex:0,lastScrollPos:0,rowIndex:0,isBuffering:false,requestQueue:-1,loadMask:false,isPrebuffering:false,_loadMaskAnchor:null,reset:function(C){if(C===false){this.ds.modified=[];this.rowIndex=0;this.lastScrollPos=0;this.lastRowIndex=0;this.lastIndex=0;this.adjustVisibleRows();this.adjustScrollerPos(-this.liveScroller.dom.scrollTop,true);this.showLoadMask(false);this.refresh(true);this.fireEvent("cursormove",this,0,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);return false}else{var B={};var A=this.ds.sortInfo;if(A){B={dir:A.direction,sort:A.field}}return this.ds.load({params:B})}},renderUI:function(){var A=this.grid;var B=A.enableDragDrop||A.enableDrag;A.enableDragDrop=false;A.enableDrag=false;this._gridViewSuperclass.renderUI.call(this);var A=this.grid;A.enableDragDrop=B;A.enableDrag=B;if(B){this.dragZone=new Ext.ux.grid.livegrid.DragZone(A,{ddGroup:A.ddGroup||"GridDD"})}if(this.loadMask){this._loadMaskAnchor=Ext.get(this.mainBody.dom.parentNode.parentNode);Ext.apply(this.loadMask,{msgCls:"x-mask-loading"});this._loadMaskAnchor.mask(this.loadMask.msg,this.loadMask.msgCls);this._loadMaskAnchor._mask.addClass("ext-ux-livegrid");this._loadMaskAnchor._mask.setDisplayed(false);this._loadMaskAnchor._maskMsg.setDisplayed(false)}},init:function(A){this._gridViewSuperclass.init.call(this,A);A.on("expand",this._onExpand,this)},initData:function(B,A){if(this.ds){this.ds.un("bulkremove",this.onBulkRemove,this);this.ds.un("beforeload",this.onBeforeLoad,this)}if(B){B.on("bulkremove",this.onBulkRemove,this);B.on("beforeload",this.onBeforeLoad,this)}this._gridViewSuperclass.initData.call(this,B,A)},renderBody:function(){var A=this.renderRows(0,this.visibleRows-1);return this.templates.body.apply({rows:A})},doRender:function(C,B,E,A,D,F){return this._gridViewSuperclass.doRender.call(this,C,B,E,A+this.ds.bufferRange[0],D,F)},initElements:function(){var D=Ext.Element;var B=this.grid.getGridEl().dom.firstChild;var A=B.childNodes;this.el=new D(B);this.mainWrap=new D(A[1]);this.liveScroller=new D(A[0]);this.liveScrollerInset=this.liveScroller.dom.firstChild;this.liveScroller.on("scroll",this.onLiveScroll,this,{buffer:this.scrollDelay});var C=this.mainWrap.dom.firstChild;this.mainHd=new D(C);this.hdHeight=C.offsetHeight;this.innerHd=this.mainHd.dom.firstChild;this.scroller=new D(this.mainWrap.dom.childNodes[1]);if(this.forceFit){this.scroller.setStyle("overflow-x","hidden")}this.mainBody=new D(this.scroller.dom.firstChild);this.mainBody.on("mousewheel",this.handleWheel,this);this.focusEl=new D(this.scroller.dom.childNodes[1]);this.focusEl.swallowEvent("click",true);this.resizeMarker=new D(A[2]);this.resizeProxy=new D(A[3])},layout:function(){if(!this.mainBody){return }var E=this.grid;var G=E.getGridEl(),I=this.cm,B=E.autoExpandColumn,A=this;var C=G.getSize(true);var H=C.width;if(H<20||C.height<20){return }if(E.autoHeight){this.scroller.dom.style.overflow="visible"}else{this.el.setSize(C.width,C.height);var F=this.mainHd.getHeight();var D=C.height-(F);this.scroller.setSize(H,D);if(this.innerHd){this.innerHd.style.width=(H)+"px"}}this.liveScroller.dom.style.top=this.hdHeight+"px";if(this.forceFit){if(this.lastViewWidth!=H){this.fitColumns(false,false);this.lastViewWidth=H}}else{this.autoExpand()}this.adjustVisibleRows();this.adjustBufferInset();this.onLayout(H,D)},removeRow:function(A){Ext.removeNode(this.getRow(A))},removeRows:function(C,A){var B=this.mainBody.dom;for(var D=C;D<=A;D++){Ext.removeNode(B.childNodes[C])}},_onExpand:function(A){this.adjustVisibleRows();this.adjustBufferInset();this.adjustScrollerPos(this.rowHeight*this.rowIndex,true)},onColumnMove:function(A,C,B){this.indexMap=null;this.replaceLiveRows(this.rowIndex,true);this.updateHeaders();this.updateHeaderSortState();this.afterMove(B)},onColumnWidthUpdated:function(C,A,B){this.adjustVisibleRows();this.adjustBufferInset()},onAllColumnWidthsUpdated:function(A,B){this.adjustVisibleRows();this.adjustBufferInset()},onRowSelect:function(A){if(A<this.rowIndex||A>this.rowIndex+this.visibleRows){return }this.addRowClass(A,"x-grid3-row-selected")},onRowDeselect:function(A){if(A<this.rowIndex||A>this.rowIndex+this.visibleRows){return }this.removeRowClass(A,"x-grid3-row-selected")},onClear:function(){this.reset(false)},onBulkRemove:function(L,M){var H=null;var J=0;var O=0;var K=M.length;var A=false;var I=false;var F=0;if(K==0){return }var C=this.rowIndex;var B=0;var E=0;var D=0;for(var G=0;G<K;G++){H=M[G][0];J=M[G][1];O=(J!=Number.MIN_VALUE&&J!=Number.MAX_VALUE)?J+this.ds.bufferRange[0]:J;if(O<this.rowIndex){B++}else{if(O>=this.rowIndex&&O<=this.rowIndex+(this.visibleRows-1)){D++}else{if(O>=this.rowIndex+this.visibleRows){E++}}}this.fireEvent("beforerowremoved",this,O,H);this.fireEvent("rowremoved",this,O,H)}var N=this.ds.totalLength;this.rowIndex=Math.max(0,Math.min(this.rowIndex-B,N-(this.visibleRows-1)));this.lastRowIndex=this.rowIndex;this.adjustScrollerPos(-(B*this.rowHeight),true);this.updateLiveRows(this.rowIndex,true);this.adjustBufferInset();this.processRows(0,undefined,false)},onRemove:function(C,A,B){this.onBulkRemove(C,[[A,B]])},onAdd:function(B,C,G){var F=C.length;if(G==Number.MAX_VALUE||G==Number.MIN_VALUE){this.fireEvent("beforerowsinserted",this,G,G);if(G==Number.MIN_VALUE){this.rowIndex=this.rowIndex+F;this.lastRowIndex=this.rowIndex;this.adjustBufferInset();this.adjustScrollerPos(this.rowHeight*F,true);this.fireEvent("rowsinserted",this,G,G,F);this.processRows(0,undefined,false);this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);return }this.adjustBufferInset();this.fireEvent("rowsinserted",this,G,G,F);return }var A=G+this.ds.bufferRange[0];var E=A+(F-1);var H=this.getRows().length;var D=0;var I=0;if(A>this.rowIndex+(this.visibleRows-1)){this.fireEvent("beforerowsinserted",this,A,E);this.fireEvent("rowsinserted",this,A,E,F);this.adjustVisibleRows();this.adjustBufferInset()}else{if(A>=this.rowIndex&&A<=this.rowIndex+(this.visibleRows-1)){D=G;I=G+(F-1);this.lastRowIndex=this.rowIndex;this.rowIndex=(A>this.rowIndex)?this.rowIndex:A;this.insertRows(B,D,I);if(this.lastRowIndex!=this.rowIndex){this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength)}this.adjustVisibleRows();this.adjustBufferInset()}else{if(A<this.rowIndex){this.fireEvent("beforerowsinserted",this,A,E);this.rowIndex=this.rowIndex+F;this.lastRowIndex=this.rowIndex;this.adjustVisibleRows();this.adjustBufferInset();this.adjustScrollerPos(this.rowHeight*F,true);this.fireEvent("rowsinserted",this,A,E,F);this.processRows(0,undefined,true);this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength)}}}},onBeforeLoad:function(B,C){C.params=C.params||{};var A=Ext.apply;A(C,{scope:this,callback:function(){this.reset(false)},suspendLoadEvent:false});A(C.params,{start:0,limit:this.ds.bufferSize});return true},onLoad:function(C,B,A){this.adjustBufferInset()},onDataChange:function(A){this.updateHeaderSortState()},liveBufferUpdate:function(A,B,D){if(D===true){this.adjustBufferInset();this.fireEvent("buffer",this,this.ds,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength,B);this.isBuffering=false;this.isPrebuffering=false;this.showLoadMask(false);this.grid.selModel.replaceSelections(A);if(this.isInRange(this.rowIndex)){this.replaceLiveRows(this.rowIndex,B.forceRepaint)}else{this.updateLiveRows(this.rowIndex)}if(this.requestQueue>=0){var C=this.requestQueue;this.requestQueue=-1;this.updateLiveRows(C)}return }else{this.fireEvent("bufferfailure",this,this.ds,B)}this.requestQueue=-1;this.isBuffering=false;this.isPrebuffering=false;this.showLoadMask(false)},handleWheel:function(A){if(this.rowHeight==-1){A.stopEvent();return }var B=A.getWheelDelta();this.adjustScrollerPos(-(B*this.rowHeight));A.stopEvent()},onLiveScroll:function(){var A=this.liveScroller.dom.scrollTop;var B=Math.floor((A)/this.rowHeight);this.rowIndex=B;if(B==this.lastRowIndex){return }this.updateLiveRows(B);this.lastScrollPos=this.liveScroller.dom.scrollTop},refreshRow:function(A){var D=this.ds,C;if(typeof A=="number"){C=A;A=D.getAt(C)}else{C=D.indexOf(A)}var B=C+this.ds.bufferRange[0];if(B<this.rowIndex||B>=this.rowIndex+this.visibleRows){this.fireEvent("rowupdated",this,B,A);return }this.insertRows(D,C,C,true);this.fireEvent("rowupdated",this,B,A)},processRows:function(I,H,E){H=H||!this.grid.stripeRows;I=0;var N=this.getRows();var K=" x-grid3-row-alt ";var J=this.rowIndex;var G=0;var A=this.grid.selModel.selections;var B=this.ds;var M=null;for(var D=I,F=N.length;D<F;D++){G=D+J;M=N[D];M.rowIndex=G;if(E!==false){if(this.grid.selModel.isSelected(this.ds.getAt(G))===true){this.addRowClass(G,"x-grid3-row-selected")}else{this.removeRowClass(G,"x-grid3-row-selected")}this.fly(M).removeClass("x-grid3-row-over")}if(!H){var C=((G+1)%2==0);var L=(" "+M.className+" ").indexOf(K)!=-1;if(C==L){continue}if(C){M.className+=" x-grid3-row-alt"}else{M.className=M.className.replace("x-grid3-row-alt","")}}}},insertRows:function(E,B,M,L){var A=B+this.ds.bufferRange[0];var F=M+this.ds.bufferRange[0];if(!L){this.fireEvent("beforerowsinserted",this,A,F)}if(L!==true&&(this.getRows().length+(M-B))>=this.visibleRows){this.removeRows((this.visibleRows-1)-(M-B),this.visibleRows-1)}else{if(L){this.removeRows(A-this.rowIndex,F-this.rowIndex)}}var G=(B==M)?M:Math.min(M,(this.rowIndex-this.ds.bufferRange[0])+(this.visibleRows-1));var D=this.renderRows(B,G);var I=this.getRow(A);if(I){Ext.DomHelper.insertHtml("beforeBegin",I,D)}else{Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,D)}if(L===true){var K=this.getRows();var J=this.rowIndex;for(var C=0,H=K.length;C<H;C++){K[C].rowIndex=J+C}}if(!L){this.fireEvent("rowsinserted",this,A,F,(F-A)+1);this.processRows(0,undefined,true)}},getRow:function(A){if(A-this.rowIndex<0){return null}return this.getRows()[A-this.rowIndex]},getCell:function(B,A){var B=this.getRow(B);return B?B.getElementsByTagName("td")[A]:null},focusCell:function(D,A,C){var B=this.ensureVisible(D,A,C);if(!B){return }this.focusEl.setXY(B);if(Ext.isGecko){this.focusEl.focus()}else{this.focusEl.focus.defer(1,this.focusEl)}},ensureVisible:function(K,C,B){if(typeof K!="number"){K=K.rowIndex}if(K<0||K>=this.ds.totalLength){return }C=(C!==undefined?C:0);var H=K-this.rowIndex;if(this.rowClipped&&K==this.rowIndex+this.visibleRows-1){this.adjustScrollerPos(this.rowHeight)}else{if(K>=this.rowIndex+this.visibleRows){this.adjustScrollerPos(((K-(this.rowIndex+this.visibleRows))+1)*this.rowHeight)}else{if(K<=this.rowIndex){this.adjustScrollerPos((H)*this.rowHeight)}}}var G=this.getRow(K),D;if(!G){return }if(!(B===false&&C===0)){while(this.cm.isHidden(C)){C++}D=this.getCell(K,C)}var J=this.scroller.dom;if(B!==false){var I=parseInt(D.offsetLeft,10);var F=I+D.offsetWidth;var E=parseInt(J.scrollLeft,10);var A=E+J.clientWidth;if(I<E){J.scrollLeft=I}else{if(F>A){J.scrollLeft=F-J.clientWidth}}}return D?Ext.fly(D).getXY():[J.scrollLeft+this.el.getX(),Ext.fly(G).getY()]},isRecordRendered:function(A){var B=this.ds.indexOf(A);if(B>=this.rowIndex&&B<this.rowIndex+this.visibleRows){return true}return false},isInRange:function(B){var A=Math.min(this.ds.totalLength-1,B+(this.visibleRows-1));return(B>=this.ds.bufferRange[0])&&(A<=this.ds.bufferRange[1])},getPredictedBufferIndex:function(A,B,C){if(!B){if(A+this.ds.bufferSize>=this.ds.totalLength){return this.ds.totalLength-this.ds.bufferSize}return Math.max(0,(A+this.visibleRows)-Math.round(this.ds.bufferSize/2))}if(!C){return Math.max(0,(A-this.ds.bufferSize)+this.visibleRows)}if(C){return Math.max(0,Math.min(A,this.ds.totalLength-this.ds.bufferSize))}},updateLiveRows:function(G,H,D){var J=this.isInRange(G);if(this.isBuffering){if(this.isPrebuffering){if(J){this.replaceLiveRows(G,H)}else{this.showLoadMask(true)}}this.fireEvent("cursormove",this,G,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);this.requestQueue=G;return }var E=this.lastIndex;this.lastIndex=G;var J=this.isInRange(G);var I=false;if(J&&D!==true){this.replaceLiveRows(G,H);this.fireEvent("cursormove",this,G,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);if(G>E){I=true;var K=this.ds.totalLength;if(G+this.visibleRows+this.nearLimit<=this.ds.bufferRange[1]){return }if(this.ds.bufferRange[1]+1>=K){return }}else{if(G<E){I=false;if(this.ds.bufferRange[0]<=0){return }if(G-this.nearLimit>this.ds.bufferRange[0]){return }}else{return }}this.isPrebuffering=true}this.isBuffering=true;var B=this.getPredictedBufferIndex(G,J,I);if(!J){this.showLoadMask(true)}this.ds.suspendEvents();var F=this.ds.sortInfo;var C={};if(this.ds.lastOptions){Ext.apply(C,this.ds.lastOptions.params)}C.start=B;C.limit=this.ds.bufferSize;if(F){C.dir=F.direction;C.sort=F.field}var A={forceRepaint:H,callback:this.liveBufferUpdate,scope:this,params:C,suspendLoadEvent:true};this.fireEvent("beforebuffer",this,this.ds,G,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength,A);this.ds.load(A);this.ds.resumeEvents()},showLoadMask:function(B){if(!this.loadMask){return }var A=this._loadMaskAnchor._mask;var C=this._loadMaskAnchor._maskMsg;if(B){A.setDisplayed(true);C.setDisplayed(true);C.center(this._loadMaskAnchor);if(Ext.isIE&&!(Ext.isIE7&&Ext.isStrict)&&this._loadMaskAnchor.getStyle("height")=="auto"){A.setSize(undefined,this._loadMaskAnchor.getHeight())}}else{A.setDisplayed(false);C.setDisplayed(false)}},replaceLiveRows:function(H,G,C){var D=H-this.lastRowIndex;if(D==0&&G!==true){return }var A=D>0;D=Math.abs(D);var B=this.ds.bufferRange;var I=H-B[0];var E=Math.min(I+this.visibleRows-1,B[1]-B[0]);if(D>=this.visibleRows||D==0){this.mainBody.update(this.renderRows(I,E))}else{if(A){this.removeRows(0,D-1);if(I+this.visibleRows-D<=B[1]-B[0]){var F=this.renderRows(I+this.visibleRows-D,E);Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,F)}}else{this.removeRows(this.visibleRows-D,this.visibleRows-1);var F=this.renderRows(I,I+D-1);Ext.DomHelper.insertHtml("beforeBegin",this.mainBody.dom.firstChild,F)}}if(C!==false){this.processRows(0,undefined,true)}this.lastRowIndex=H},adjustBufferInset:function(){var B=this.liveScroller.dom;var D=this.grid,E=D.store;var H=D.getGridEl();var C=H.getSize().width;var F=(E.totalLength==this.visibleRows-this.rowClipped)?0:Math.max(0,E.totalLength-(this.visibleRows-this.rowClipped));if(F==0){this.scroller.setWidth(C);B.style.display="none";return }else{this.scroller.setWidth(C-this.scrollOffset);B.style.display=""}var G=this.cm.getTotalWidth()+this.scrollOffset>C;var A=B.parentNode.offsetHeight+((E.totalLength>0&&G)?-this.horizontalScrollOffset:0)-this.hdHeight;B.style.height=Math.max(A,this.horizontalScrollOffset*2)+"px";if(this.rowHeight==-1){return }this.liveScrollerInset.style.height=(F==0?0:A+(F*this.rowHeight))+"px"},adjustVisibleRows:function(){if(this.rowHeight==-1){if(this.getRows()[0]){this.rowHeight=this.getRows()[0].offsetHeight;if(this.rowHeight<=0){this.rowHeight=-1;return }}else{return }}var E=this.grid,C=E.store;var F=E.getGridEl();var H=this.cm;var J=F.getSize();var B=J.width;var D=J.height;var G=B-this.scrollOffset;if(H.getTotalWidth()>G){D-=this.horizontalScrollOffset}D-=this.mainHd.getHeight();var I=C.totalLength||0;var A=Math.max(1,Math.floor(D/this.rowHeight));this.rowClipped=0;if(I>A&&this.rowHeight/3<(D-(A*this.rowHeight))){A=Math.min(A+1,I);this.rowClipped=1}if(this.visibleRows==A){return }this.visibleRows=A;if(this.isBuffering&&!this.isPrebuffering){return }if(this.rowIndex+(A-this.rowClipped)>I){this.rowIndex=Math.max(0,I-(A-this.rowClipped));this.lastRowIndex=this.rowIndex}this.updateLiveRows(this.rowIndex,true)},adjustScrollerPos:function(D,A){if(D==0){return }var C=this.liveScroller;var B=C.dom;if(A===true){C.un("scroll",this.onLiveScroll,this)}this.lastScrollPos=B.scrollTop;B.scrollTop+=D;if(A===true){B.scrollTop=B.scrollTop;C.on("scroll",this.onLiveScroll,this,{buffer:this.scrollDelay})}}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.JsonReader=function(A,B){Ext.ux.grid.livegrid.JsonReader.superclass.constructor.call(this,A,B)};Ext.extend(Ext.ux.grid.livegrid.JsonReader,Ext.data.JsonReader,{readRecords:function(D){var B=this.meta;if(!this.ef&&B.versionProperty){this.getVersion=this.getJsonAccessor(B.versionProperty)}if(!this.__readRecords){this.__readRecords=Ext.ux.grid.livegrid.JsonReader.superclass.readRecords}var C=this.__readRecords.call(this,D);if(B.versionProperty){var A=this.getVersion(D);C.version=(A===undefined||A==="")?null:A}return C}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.RowSelectionModel=function(A){this.addEvents({selectiondirty:true});Ext.apply(this,A);this.pendingSelections={};Ext.ux.grid.livegrid.RowSelectionModel.superclass.constructor.call(this)};Ext.extend(Ext.ux.grid.livegrid.RowSelectionModel,Ext.grid.RowSelectionModel,{initEvents:function(){Ext.ux.grid.livegrid.RowSelectionModel.superclass.initEvents.call(this);this.grid.view.on("rowsinserted",this.onAdd,this);this.grid.store.on("selectionsload",this.onSelectionsLoad,this)},onRemove:function(B,D,G){var A=this.getPendingSelections();var C=A.length;var F=false;if(D==Number.MIN_VALUE||D==Number.MAX_VALUE){if(G){if(this.isIdSelected(G.id)&&D==Number.MIN_VALUE){this.shiftSelections(this.grid.store.bufferRange[1],-1)}this.selections.remove(G);F=true}if(D==Number.MIN_VALUE){this.clearPendingSelections(0,this.grid.store.bufferRange[0])}else{this.clearPendingSelections(this.grid.store.bufferRange[1])}if(C!=0){this.fireEvent("selectiondirty",this,D,1)}}else{F=this.isIdSelected(G.id);if(!F){return }this.selections.remove(G);if(C!=0){var H=A[0];var E=A[C-1];if(D<=E||D<=H){this.shiftSelections(D,-1);this.fireEvent("selectiondirty",this,D,1)}}}if(F){this.fireEvent("selectionchange",this)}},onAdd:function(G,E,D,B){var A=this.getPendingSelections();var H=A.length;if((E==Number.MIN_VALUE||E==Number.MAX_VALUE)){if(E==Number.MIN_VALUE){this.clearPendingSelections(0,this.grid.store.bufferRange[0]);this.shiftSelections(this.grid.store.bufferRange[1],B)}else{this.clearPendingSelections(this.grid.store.bufferRange[1])}if(H!=0){this.fireEvent("selectiondirty",this,E,r)}return }var F=A[0];var C=A[H-1];var I=E;if(I<=C||I<=F){this.fireEvent("selectiondirty",this,I,B);this.shiftSelections(I,B)}},shiftSelections:function(L,C){var H=0;var K=0;var B={};var D=this.grid.store;var I=L-D.bufferRange[0];var F=0;var M=this.grid.store.totalLength;var E=null;var A=this.getPendingSelections();var J=A.length;if(J==0){return }for(var G=0;G<J;G++){H=A[G];if(H<L){continue}K=H+C;F=I+C;if(K>=M){break}E=D.getAt(F);if(E){this.selections.add(E)}else{B[K]=true}}this.pendingSelections=B},onSelectionsLoad:function(C,B,A){this.replaceSelections(B)},hasNext:function(){return this.last!==false&&(this.last+1)<this.grid.store.getTotalCount()},getCount:function(){return this.selections.length+this.getPendingSelections().length},isSelected:function(A){if(typeof A=="number"){var B=A;A=this.grid.store.getAt(B);if(!A){var D=this.getPendingSelections().indexOf(B);if(D!=-1){return true}return false}}var C=A;return(C&&this.selections.key(C.id)?true:false)},deselectRecord:function(A,C){if(this.locked){return }var E=this.selections.key(A.id);if(!E){return }var B=this.grid.store;var D=B.indexOfId(A.id);if(D==-1){D=B.findInsertIndex(A);if(D!=Number.MIN_VALUE&&D!=Number.MAX_VALUE){D+=B.bufferRange[0]}}else{delete this.pendingSelections[D]}if(this.last==D){this.last=false}if(this.lastActive==D){this.lastActive=false}this.selections.remove(A);if(!C){this.grid.getView().onRowDeselect(D)}this.fireEvent("rowdeselect",this,D,A);this.fireEvent("selectionchange",this)},deselectRow:function(B,A){if(this.locked){return }if(this.last==B){this.last=false}if(this.lastActive==B){this.lastActive=false}var C=this.grid.store.getAt(B);delete this.pendingSelections[B];if(C){this.selections.remove(C)}if(!A){this.grid.getView().onRowDeselect(B)}this.fireEvent("rowdeselect",this,B,C);this.fireEvent("selectionchange",this)},selectRow:function(B,D,A){if(this.locked||B<0||B>=this.grid.store.getTotalCount()){return }var C=this.grid.store.getAt(B);if(this.fireEvent("beforerowselect",this,B,D,C)!==false){if(!D||this.singleSelect){this.clearSelections()}if(C){this.selections.add(C);delete this.pendingSelections[B]}else{this.pendingSelections[B]=true}this.last=this.lastActive=B;if(!A){this.grid.getView().onRowSelect(B)}this.fireEvent("rowselect",this,B,C);this.fireEvent("selectionchange",this)}},clearPendingSelections:function(G,F){if(F==undefined){F=Number.MAX_VALUE}var B={};var A=this.getPendingSelections();var D=A.length;var C=0;for(var E=0;E<D;E++){C=A[E];if(C<=F&&C>=G){continue}B[C]=true}this.pendingSelections=B},replaceSelections:function(E){if(!E||E.length==0){return }var D=this.grid.store;var F=null;var I=[];var A=this.getPendingSelections();var J=A.length;var C=this.selections;var H=0;for(var G=0;G<J;G++){H=A[G];F=D.getAt(H);if(F){C.add(F);I.push(F.id);delete this.pendingSelections[H]}}var B=null;for(G=0,len=E.length;G<len;G++){F=E[G];B=F.id;if(I.indexOf(B)==-1&&C.containsKey(B)){C.add(F)}}},getPendingSelections:function(F){var D=1;var C=[];var B=0;var G=[];for(var E in this.pendingSelections){G.push(parseInt(E))}G.sort(function(I,H){if(I>H){return 1}else{if(I<H){return -1}else{return 0}}});if(!F){return G}var A=G.length;if(A==0){return[]}C[B]=[G[0],G[0]];for(var E=0,A=A-1;E<A;E++){if(G[E+1]-G[E]==1){C[B][1]=G[E+1]}else{B++;C[B]=[G[E+1],G[E+1]]}}return C},clearSelections:function(A){if(this.locked){return }if(A!==true){var D=this.grid.store;var B=this.selections;var C=-1;B.each(function(E){C=D.indexOfId(E.id);if(C!=-1){this.deselectRow(C+D.bufferRange[0])}},this);B.clear();this.pendingSelections={}}else{this.selections.clear();this.pendingSelections={}}this.last=false},selectRange:function(B,A,D){if(this.locked){return }if(!D){this.clearSelections()}if(B<=A){for(var C=B;C<=A;C++){this.selectRow(C,true)}}else{for(var C=B;C>=A;C--){this.selectRow(C,true)}}}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.Store=function(A){A=A||{};A.remoteSort=true;this._autoLoad=A.autoLoad?true:false;A.autoLoad=false;this.addEvents("bulkremove","versionchange","beforeselectionsload","selectionsload");Ext.ux.grid.livegrid.Store.superclass.constructor.call(this,A);this.totalLength=0;this.bufferRange=[-1,-1];this.on("clear",function(){this.bufferRange=[-1,-1]},this);if(this.url&&!this.selectionsProxy){this.selectionsProxy=new Ext.data.HttpProxy({url:this.url})}};Ext.extend(Ext.ux.grid.livegrid.Store,Ext.data.Store,{version:null,insert:function(D,C){C=[].concat(C);D=D>=this.bufferSize?Number.MAX_VALUE:D;if(D==Number.MIN_VALUE||D==Number.MAX_VALUE){var B=C.length;if(D==Number.MIN_VALUE){this.bufferRange[0]+=B;this.bufferRange[1]+=B}this.totalLength+=B;this.fireEvent("add",this,C,D);return }var F=false;var G=C;if(C.length+D>=this.bufferSize){F=true;G=C.splice(0,this.bufferSize-D)}this.totalLength+=G.length;if(this.bufferRange[0]<=-1){this.bufferRange[0]=0}if(this.bufferRange[1]<(this.bufferSize-1)){this.bufferRange[1]=Math.min(this.bufferRange[1]+G.length,this.bufferSize-1)}for(var E=0,A=G.length;E<A;E++){this.data.insert(D,G[E]);G[E].join(this)}while(this.getCount()>this.bufferSize){this.data.remove(this.data.last())}this.fireEvent("add",this,G,D);if(F==true){this.fireEvent("add",this,C,Number.MAX_VALUE)}},remove:function(B,A){var C=this._getIndex(B);if(C<0){this.totalLength-=1;if(this.pruneModifiedRecords){this.modified.remove(B)}this.bufferRange[0]=Math.max(-1,this.bufferRange[0]-1);this.bufferRange[1]=Math.max(-1,this.bufferRange[1]-1);if(A!==true){this.fireEvent("remove",this,B,C)}return C}this.bufferRange[1]=Math.max(-1,this.bufferRange[1]-1);this.data.removeAt(C);if(this.pruneModifiedRecords){this.modified.remove(B)}this.totalLength-=1;if(A!==true){this.fireEvent("remove",this,B,C)}return C},_getIndex:function(A){var B=this.indexOfId(A.id);if(B<0){B=this.findInsertIndex(A)}return B},bulkRemove:function(B){var G=null;var E=[];var D=0;var A=B.length;var F=[];for(var C=0;C<A;C++){G=B[C];F[G.id]=this._getIndex(G)}for(var C=0;C<A;C++){G=B[C];this.remove(G,true);E.push([G,F[G.id]])}this.fireEvent("bulkremove",this,E)},removeAll:function(){this.totalLength=0;this.bufferRange=[-1,-1];this.data.clear();if(this.pruneModifiedRecords){this.modified=[]}this.fireEvent("clear",this)},loadRanges:function(B){var A=B.length;if(A>0&&!this.selectionsProxy.activeRequest&&this.fireEvent("beforeselectionsload",this,B)!==false){var E=this.lastOptions.params;var F={};F.ranges=Ext.encode(B);if(E){if(E.sort){F.sort=E.sort}if(E.dir){F.dir=E.dir}}var C={};for(var D in this.lastOptions){C.i=this.lastOptions.i}C.ranges=F.ranges;this.selectionsProxy.load(F,this.reader,this.selectionsLoaded,this,C)}},loadSelections:function(A){if(A.length==0){return }this.loadRanges(A)},selectionsLoaded:function(F,B,E){if(this.checkVersionChange(F,B,E)!==false){var D=F.records;for(var C=0,A=D.length;C<A;C++){D[C].join(this)}this.fireEvent("selectionsload",this,F.records,Ext.decode(B.ranges))}else{this.fireEvent("selectionsload",this,[],Ext.decode(B.ranges))}},checkVersionChange:function(D,B,C){if(D&&C!==false){if(D.version!==undefined){var A=this.version;this.version=D.version;if(this.version!==A){return this.fireEvent("versionchange",this,A,this.version)}}}},findInsertIndex:function(A){this.remoteSort=false;var B=Ext.ux.grid.livegrid.Store.superclass.findInsertIndex.call(this,A);this.remoteSort=true;if(this.bufferRange[0]<=0&&B==0){return B}else{if(this.bufferRange[0]>0&&B==0){return Number.MIN_VALUE}else{if(B>=this.bufferSize){return Number.MAX_VALUE}}}return B},sortData:function(C,D){D=D||"ASC";var A=this.fields.get(C).sortType;var B=function(F,E){var H=A(F.data[C]),G=A(E.data[C]);return H>G?1:(H<G?-1:0)};this.data.sort(D,B)},onMetaChange:function(B,A,C){this.version=null;Ext.ux.grid.livegrid.Store.superclass.onMetaChange.call(this,B,A,C)},loadRecords:function(C,A,B){this.checkVersionChange(C,A,B);if(!C){this.bufferRange=[-1,-1]}else{this.bufferRange=[A.params.start,Math.max(0,Math.min((A.params.start+A.params.limit)-1,C.totalRecords-1))]}if(A.suspendLoadEvent===true){this.suspendEvents()}Ext.ux.grid.livegrid.Store.superclass.loadRecords.call(this,C,A,B);if(A.suspendLoadEvent===true){this.resumeEvents()}},getAt:function(A){if(this.bufferRange[0]==-1){return undefined}var B=A-this.bufferRange[0];return this.data.itemAt(B)},clearFilter:function(){},isFiltered:function(){},collect:function(){},createFilterFn:function(){},sum:function(){},filter:function(){},filterBy:function(){},query:function(){},queryBy:function(){},find:function(){},findBy:function(){}});1 Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.GridPanel=Ext.extend(Ext.grid.GridPanel,{initComponent:function(){if(this.cls){this.cls+=" ext-ux-livegrid"}else{this.cls="ext-ux-livegrid"}Ext.ux.grid.livegrid.GridPanel.superclass.initComponent.call(this)},onRender:function(B,A){Ext.ux.grid.livegrid.GridPanel.superclass.onRender.call(this,B,A);var C=this.getStore();if(C._autoLoad===true){delete C._autoLoad;C.load()}},walkCells:function(H,C,F,E,D){var G=this.store;var A=G.getCount;G.getCount=G.getTotalCount;var B=Ext.ux.grid.livegrid.GridPanel.superclass.walkCells.call(this,H,C,F,E,D);G.getCount=A;return B}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.GridView=function(A){this.addEvents({beforebuffer:true,buffer:true,bufferfailure:true,cursormove:true,abortrequest:true});this.horizontalScrollOffset=17;this._checkEmptyBody=true;Ext.apply(this,A);this.templates={};this.templates.master=new Ext.Template('<div class="x-grid3" hidefocus="true"><div class="liveScroller"><div></div></div>','<div class="x-grid3-viewport"">','<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset" style="{ostyle}">{header}</div></div><div class="x-clear"></div></div>','<div class="x-grid3-scroller" style="overflow-y:hidden !important;"><div class="x-grid3-body" style="{bstyle}">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',"</div>",'<div class="x-grid3-resize-marker"> </div>','<div class="x-grid3-resize-proxy"> </div>',"</div>");this._gridViewSuperclass=Ext.ux.grid.livegrid.GridView.superclass;this._gridViewSuperclass.constructor.call(this)};Ext.extend(Ext.ux.grid.livegrid.GridView,Ext.grid.GridView,{hdHeight:0,rowClipped:0,liveScroller:null,liveScrollerInset:null,rowHeight:-1,visibleRows:1,lastIndex:-1,lastRowIndex:0,lastScrollPos:0,rowIndex:0,isBuffering:false,requestQueue:-1,loadMask:false,loadMaskDisplayed:false,isPrebuffering:false,_loadMaskAnchor:null,reset:function(D){if(D===false){this.ds.modified=[];this.rowIndex=0;this.lastScrollPos=0;this.lastRowIndex=0;this.lastIndex=0;this.adjustVisibleRows();this.adjustScrollerPos(-this.liveScroller.dom.scrollTop,true);this.showLoadMask(false);var B=this.processRows;this.processRows=Ext.emptyFn;this.refresh(true);this.processRows=B;this.processRows(0);this.fireEvent("cursormove",this,0,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);return false}else{var C={};var A=this.ds.sortInfo;if(A){C={dir:A.direction,sort:A.field}}return this.ds.load({params:C})}},renderUI:function(){var A=this.grid;var C=A.enableDragDrop||A.enableDrag;A.enableDragDrop=false;A.enableDrag=false;this._gridViewSuperclass.renderUI.call(this);var A=this.grid;A.enableDragDrop=C;A.enableDrag=C;if(C){this.dragZone=new Ext.ux.grid.livegrid.DragZone(A,{ddGroup:A.ddGroup||"GridDD"})}if(this.loadMask){this._loadMaskAnchor=Ext.get(this.mainBody.dom.parentNode.parentNode);Ext.apply(this.loadMask,{msgCls:"x-mask-loading"});this._loadMaskAnchor.mask(this.loadMask.msg,this.loadMask.msgCls);var D=this._loadMaskAnchor.dom;var B=Ext.Element.data;B(D,"mask").addClass("ext-ux-livegrid");B(D,"mask").setDisplayed(false);B(D,"maskMsg").setDisplayed(false)}},init:function(A){this._gridViewSuperclass.init.call(this,A);A.on("expand",this._onExpand,this)},initData:function(B,A){if(this.ds){this.ds.un("bulkremove",this.onBulkRemove,this);this.ds.un("beforeload",this.onBeforeLoad,this)}if(B){B.on("bulkremove",this.onBulkRemove,this);B.on("beforeload",this.onBeforeLoad,this)}this._gridViewSuperclass.initData.call(this,B,A)},renderBody:function(){var A=this.renderRows(0,this.visibleRows-1);return this.templates.body.apply({rows:A})},doRender:function(C,B,E,A,D,F){return this._gridViewSuperclass.doRender.call(this,C,B,E,A+this.ds.bufferRange[0],D,F)},initElements:function(){var D=Ext.Element;var B=this.grid.getGridEl().dom.firstChild;var A=B.childNodes;this.el=new D(B);this.mainWrap=new D(A[1]);this.liveScroller=new D(A[0]);this.liveScrollerInset=this.liveScroller.dom.firstChild;this.liveScroller.on("scroll",this.onLiveScroll,this,{buffer:this.scrollDelay});var C=this.mainWrap.dom.firstChild;this.mainHd=new D(C);this.hdHeight=C.offsetHeight;this.innerHd=this.mainHd.dom.firstChild;this.scroller=new D(this.mainWrap.dom.childNodes[1]);if(this.forceFit){this.scroller.setStyle("overflow-x","hidden")}this.mainBody=new D(this.scroller.dom.firstChild);this.mainBody.on("mousewheel",this.handleWheel,this);this.focusEl=new D(this.scroller.dom.childNodes[1]);this.focusEl.swallowEvent("click",true);this.resizeMarker=new D(A[2]);this.resizeProxy=new D(A[3])},layout:function(){if(!this.mainBody){return }var E=this.grid;var G=E.getGridEl(),I=this.cm,B=E.autoExpandColumn,A=this;var C=G.getSize(true);var H=C.width;if(!E.hideHeaders&&H<20||C.height<20){return }if(E.autoHeight){this.scroller.dom.style.overflow="visible";if(Ext.isWebKit){this.scroller.dom.style.position="static"}}else{this.el.setSize(C.width,C.height);var F=this.mainHd.getHeight();var D=C.height-(F);this.scroller.setSize(H,D);if(this.innerHd){this.innerHd.style.width=(H)+"px"}}this.liveScroller.dom.style.top=this.hdHeight+"px";if(this.forceFit){if(this.lastViewWidth!=H){this.fitColumns(false,false);this.lastViewWidth=H}}else{this.autoExpand()}this.adjustVisibleRows();this.adjustBufferInset();this.onLayout(H,D)},removeRow:function(A){Ext.removeNode(this.getRow(A))},removeRows:function(C,A){var B=this.mainBody.dom;for(var D=C;D<=A;D++){Ext.removeNode(B.childNodes[C])}},_onExpand:function(A){this.adjustVisibleRows();this.adjustBufferInset();this.adjustScrollerPos(this.rowHeight*this.rowIndex,true)},onColumnMove:function(A,C,B){this.indexMap=null;this.replaceLiveRows(this.rowIndex,true);this.updateHeaders();this.updateHeaderSortState();this.afterMove(B);this.grid.fireEvent("columnmove",C,B)},onColumnWidthUpdated:function(C,A,B){this.adjustVisibleRows();this.adjustBufferInset()},onAllColumnWidthsUpdated:function(A,B){this.adjustVisibleRows();this.adjustBufferInset()},onRowSelect:function(A){if(A<this.rowIndex||A>this.rowIndex+this.visibleRows){return }this.addRowClass(A,this.selectedRowClass)},onRowDeselect:function(A){if(A<this.rowIndex||A>this.rowIndex+this.visibleRows){return }this.removeRowClass(A,this.selectedRowClass)},onClear:function(){this.reset(false)},onBulkRemove:function(L,M){var H=null;var J=0;var O=0;var K=M.length;var A=false;var I=false;var F=0;if(K==0){return }var C=this.rowIndex;var B=0;var E=0;var D=0;for(var G=0;G<K;G++){H=M[G][0];J=M[G][1];O=(J!=Number.MIN_VALUE&&J!=Number.MAX_VALUE)?J+this.ds.bufferRange[0]:J;if(O<this.rowIndex){B++}else{if(O>=this.rowIndex&&O<=this.rowIndex+(this.visibleRows-1)){D++}else{if(O>=this.rowIndex+this.visibleRows){E++}}}this.fireEvent("beforerowremoved",this,O,H);this.fireEvent("rowremoved",this,O,H)}var N=this.ds.totalLength;this.rowIndex=Math.max(0,Math.min(this.rowIndex-B,N-(this.visibleRows-1)));this.lastRowIndex=this.rowIndex;this.adjustScrollerPos(-(B*this.rowHeight),true);this.updateLiveRows(this.rowIndex,true);this.adjustBufferInset();this.processRows(0,undefined,false)},onRemove:function(C,A,B){this.onBulkRemove(C,[[A,B]])},onAdd:function(B,C,G){if(this._checkEmptyBody){if(this.mainBody.dom.innerHTML==" "){this.mainBody.dom.innerHTML=""}this._checkEmptyBody=false}var F=C.length;if(G==Number.MAX_VALUE||G==Number.MIN_VALUE){this.fireEvent("beforerowsinserted",this,G,G);if(G==Number.MIN_VALUE){this.rowIndex=this.rowIndex+F;this.lastRowIndex=this.rowIndex;this.adjustBufferInset();this.adjustScrollerPos(this.rowHeight*F,true);this.fireEvent("rowsinserted",this,G,G,F);this.processRows(0,undefined,false);this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);return }this.adjustBufferInset();this.fireEvent("rowsinserted",this,G,G,F);return }var A=G+this.ds.bufferRange[0];var E=A+(F-1);var H=this.getRows().length;var D=0;var I=0;if(A>this.rowIndex+(this.visibleRows-1)){this.fireEvent("beforerowsinserted",this,A,E);this.fireEvent("rowsinserted",this,A,E,F);this.adjustVisibleRows();this.adjustBufferInset()}else{if(A>=this.rowIndex&&A<=this.rowIndex+(this.visibleRows-1)){D=G;I=G+(F-1);this.lastRowIndex=this.rowIndex;this.rowIndex=(A>this.rowIndex)?this.rowIndex:A;this.insertRows(B,D,I);if(this.lastRowIndex!=this.rowIndex){this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength)}this.adjustVisibleRows();this.adjustBufferInset()}else{if(A<this.rowIndex){this.fireEvent("beforerowsinserted",this,A,E);this.rowIndex=this.rowIndex+F;this.lastRowIndex=this.rowIndex;this.adjustVisibleRows();this.adjustBufferInset();this.adjustScrollerPos(this.rowHeight*F,true);this.fireEvent("rowsinserted",this,A,E,F);this.processRows(0,undefined,true);this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength)}}}},onBeforeLoad:function(B,C){var D=B.proxy;if(D.activeRequest&&D.activeRequest[Ext.data.Api.actions.read]){D.getConnection().abort(D.activeRequest[Ext.data.Api.actions.read])}this.fireEvent("abortrequest",B,C);this.isBuffering=false;this.isPreBuffering=false;C.params=C.params||{};var A=Ext.apply;A(C,{scope:this,callback:function(){this.reset(false)},suspendLoadEvent:false});A(C.params,{start:0,limit:this.ds.bufferSize});return true},onLoad:function(C,B,A){this.adjustBufferInset()},onDataChange:function(A){this.updateHeaderSortState()},liveBufferUpdate:function(A,B,D){if(D===true){this.adjustBufferInset();this.fireEvent("buffer",this,this.ds,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength,B);this.grid.selModel.replaceSelections(A);this.isBuffering=false;this.isPrebuffering=false;this.showLoadMask(false);if(this.requestQueue>=0){var C=this.requestQueue;this.requestQueue=-1;this.updateLiveRows(C);return }if(this.isInRange(this.rowIndex)){this.replaceLiveRows(this.rowIndex,B.forceRepaint)}else{this.updateLiveRows(this.rowIndex)}return }else{this.fireEvent("bufferfailure",this,this.ds,B)}this.requestQueue=-1;this.isBuffering=false;this.isPrebuffering=false;this.showLoadMask(false)},handleWheel:function(A){if(this.rowHeight==-1){A.stopEvent();return }var B=A.getWheelDelta();this.adjustScrollerPos(-(B*this.rowHeight));A.stopEvent()},onLiveScroll:function(){var A=this.liveScroller.dom.scrollTop;var B=Math.floor((A)/this.rowHeight);this.rowIndex=B;if(B==this.lastRowIndex){return }this.updateLiveRows(B);this.lastScrollPos=this.liveScroller.dom.scrollTop},refreshRow:function(A){var D=this.ds,C;if(typeof A=="number"){C=A;A=D.getAt(C)}else{C=D.indexOf(A)}var B=C+this.ds.bufferRange[0];if(B<this.rowIndex||B>=this.rowIndex+this.visibleRows){this.fireEvent("rowupdated",this,B,A);return }this.insertRows(D,C,C,true);this.fireEvent("rowupdated",this,B,A)},processRows:function(F,D,A){if(!this.ds||this.ds.getCount()<1){return }D=D||!this.grid.stripeRows;var G=this.rowIndex;var I=this.getRows();var C=0;var H=null;for(var E=0,B=I.length;E<B;E++){H=I[E];H.rowIndex=C=G+E;H.className=H.className.replace(this.rowClsRe," ");if(!D&&(C+1)%2===0){H.className+=" x-grid3-row-alt"}if(A!==false){if(this.grid.selModel.isSelected(this.ds.getAt(C))===true){this.addRowClass(C,this.selectedRowClass)}else{this.removeRowClass(C,this.selectedRowClass)}this.fly(H).removeClass("x-grid3-row-over")}}if(G===0){Ext.fly(I[0]).addClass(this.firstRowCls)}else{if(G+I.length==this.ds.totalLength){Ext.fly(I[I.length-1]).addClass(this.lastRowCls)}}},insertRows:function(E,B,M,L){var A=B+this.ds.bufferRange[0];var F=M+this.ds.bufferRange[0];if(!L){this.fireEvent("beforerowsinserted",this,A,F)}if(L!==true&&(this.getRows().length+(M-B))>=this.visibleRows){this.removeRows((this.visibleRows-1)-(M-B),this.visibleRows-1)}else{if(L){this.removeRows(A-this.rowIndex,F-this.rowIndex)}}var G=(B==M)?M:Math.min(M,(this.rowIndex-this.ds.bufferRange[0])+(this.visibleRows-1));var D=this.renderRows(B,G);var I=this.getRow(A);if(I){Ext.DomHelper.insertHtml("beforeBegin",I,D)}else{Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,D)}if(L===true){var K=this.getRows();var J=this.rowIndex;for(var C=0,H=K.length;C<H;C++){K[C].rowIndex=J+C}}if(!L){this.fireEvent("rowsinserted",this,A,F,(F-A)+1);this.processRows(0,undefined,true)}},getRow:function(A){if(A-this.rowIndex<0){return null}return this.getRows()[A-this.rowIndex]},getCell:function(B,A){var B=this.getRow(B);return B?B.getElementsByTagName("td")[A]:null},focusCell:function(D,A,C){var B=this.ensureVisible(D,A,C);if(!B){return }this.focusEl.setXY(B);if(Ext.isGecko){this.focusEl.focus()}else{this.focusEl.focus.defer(1,this.focusEl)}},ensureVisible:function(K,C,B){if(typeof K!="number"){K=K.rowIndex}if(K<0||K>=this.ds.totalLength){return }C=(C!==undefined?C:0);var H=K-this.rowIndex;if(this.rowClipped&&K==this.rowIndex+this.visibleRows-1){this.adjustScrollerPos(this.rowHeight)}else{if(K>=this.rowIndex+this.visibleRows){this.adjustScrollerPos(((K-(this.rowIndex+this.visibleRows))+1)*this.rowHeight)}else{if(K<=this.rowIndex){this.adjustScrollerPos((H)*this.rowHeight)}}}var G=this.getRow(K),D;if(!G){return }if(!(B===false&&C===0)){while(this.cm.isHidden(C)){C++}D=this.getCell(K,C)}var J=this.scroller.dom;if(B!==false){var I=parseInt(D.offsetLeft,10);var F=I+D.offsetWidth;var E=parseInt(J.scrollLeft,10);var A=E+J.clientWidth;if(I<E){J.scrollLeft=I}else{if(F>A){J.scrollLeft=F-J.clientWidth}}}return D?Ext.fly(D).getXY():[J.scrollLeft+this.el.getX(),Ext.fly(G).getY()]},isRecordRendered:function(A){var B=this.ds.indexOf(A);if(B>=this.rowIndex&&B<this.rowIndex+this.visibleRows){return true}return false},isInRange:function(B){var A=Math.min(this.ds.totalLength-1,B+(this.visibleRows-1));return(B>=this.ds.bufferRange[0])&&(A<=this.ds.bufferRange[1])},getPredictedBufferIndex:function(A,B,C){if(!B){if(A+this.ds.bufferSize>=this.ds.totalLength){return this.ds.totalLength-this.ds.bufferSize}return Math.max(0,(A+this.visibleRows)-Math.round(this.ds.bufferSize/2))}if(!C){return Math.max(0,(A-this.ds.bufferSize)+this.visibleRows)}if(C){return Math.max(0,Math.min(A,this.ds.totalLength-this.ds.bufferSize))}},updateLiveRows:function(G,H,D){var J=this.isInRange(G);if(this.isBuffering){if(this.isPrebuffering){if(J){this.replaceLiveRows(G,H)}else{this.showLoadMask(true)}}this.fireEvent("cursormove",this,G,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);this.requestQueue=G;return }var E=this.lastIndex;this.lastIndex=G;var J=this.isInRange(G);var I=false;if(J&&D!==true){this.replaceLiveRows(G,H);this.fireEvent("cursormove",this,G,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);if(G>E){I=true;var K=this.ds.totalLength;if(G+this.visibleRows+this.nearLimit<=this.ds.bufferRange[1]){return }if(this.ds.bufferRange[1]+1>=K){return }}else{if(G<E){I=false;if(this.ds.bufferRange[0]<=0){return }if(G-this.nearLimit>this.ds.bufferRange[0]){return }}else{return }}this.isPrebuffering=true}this.isBuffering=true;var B=this.getPredictedBufferIndex(G,J,I);if(!J){this.showLoadMask(true)}this.ds.suspendEvents();var F=this.ds.sortInfo;var C={};if(this.ds.lastOptions){Ext.apply(C,this.ds.lastOptions.params)}C.start=B;C.limit=this.ds.bufferSize;if(F){C.dir=F.direction;C.sort=F.field}var A={forceRepaint:H,callback:this.liveBufferUpdate,scope:this,params:C,suspendLoadEvent:true};this.fireEvent("beforebuffer",this,this.ds,G,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength,A);this.ds.load(A);this.ds.resumeEvents()},showLoadMask:function(B){if(!this.loadMask||B==this.loadMaskDisplayed){return }var E=this._loadMaskAnchor.dom;var D=Ext.Element.data;var A=D(E,"mask");var C=D(E,"maskMsg");if(B){A.setDisplayed(true);C.setDisplayed(true);C.center(this._loadMaskAnchor);if(Ext.isIE&&!(Ext.isIE7&&Ext.isStrict)&&this._loadMaskAnchor.getStyle("height")=="auto"){A.setSize(undefined,this._loadMaskAnchor.getHeight())}}else{A.setDisplayed(false);C.setDisplayed(false)}this.loadMaskDisplayed=B},replaceLiveRows:function(H,G,C){var D=H-this.lastRowIndex;if(D==0&&G!==true){return }var A=D>0;D=Math.abs(D);var B=this.ds.bufferRange;var I=H-B[0];var E=Math.min(I+this.visibleRows-1,B[1]-B[0]);if(D>=this.visibleRows||D==0){this.mainBody.update(this.renderRows(I,E))}else{if(A){this.removeRows(0,D-1);if(I+this.visibleRows-D<=B[1]-B[0]){var F=this.renderRows(I+this.visibleRows-D,E);Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,F)}}else{this.removeRows(this.visibleRows-D,this.visibleRows-1);var F=this.renderRows(I,I+D-1);Ext.DomHelper.insertHtml("beforeBegin",this.mainBody.dom.firstChild,F)}}if(C!==false){this.processRows(0,undefined,true)}this.lastRowIndex=H},adjustBufferInset:function(){var B=this.liveScroller.dom;var D=this.grid,E=D.store;var H=D.getGridEl();var C=H.getSize().width;var F=(E.totalLength==this.visibleRows-this.rowClipped)?0:Math.max(0,E.totalLength-(this.visibleRows-this.rowClipped));if(F==0){this.scroller.setWidth(C);B.style.display="none";return }else{this.scroller.setWidth(C-this.getScrollOffset());B.style.display=""}var G=this.cm.getTotalWidth()+this.getScrollOffset()>C;var A=B.parentNode.offsetHeight+((E.totalLength>0&&G)?-this.horizontalScrollOffset:0)-this.hdHeight;B.style.height=Math.max(A,this.horizontalScrollOffset*2)+"px";if(this.rowHeight==-1){return }this.liveScrollerInset.style.height=(F==0?0:A+(F*this.rowHeight))+"px"},adjustVisibleRows:function(){if(this.rowHeight==-1){if(this.getRows()[0]){this.rowHeight=this.getRows()[0].offsetHeight;if(this.rowHeight<=0){this.rowHeight=-1;return }}else{return }}var E=this.grid,C=E.store;var F=E.getGridEl();var H=this.cm;var J=F.getSize();var B=J.width;var D=J.height;var G=B-this.getScrollOffset();if(H.getTotalWidth()>G){D-=this.horizontalScrollOffset}D-=this.mainHd.getHeight();var I=C.totalLength||0;var A=Math.max(1,Math.floor(D/this.rowHeight));this.rowClipped=0;if(I>A&&this.rowHeight/3<(D-(A*this.rowHeight))){A=Math.min(A+1,I);this.rowClipped=1}if(this.visibleRows==A){return }this.visibleRows=A;if(this.isBuffering&&!this.isPrebuffering){return }if(this.rowIndex+(A-this.rowClipped)>I){this.rowIndex=Math.max(0,I-(A-this.rowClipped));this.lastRowIndex=this.rowIndex}this.updateLiveRows(this.rowIndex,true)},adjustScrollerPos:function(D,A){if(D==0){return }var C=this.liveScroller;var B=C.dom;if(A===true){C.un("scroll",this.onLiveScroll,this)}this.lastScrollPos=B.scrollTop;B.scrollTop+=D;if(A===true){B.scrollTop=B.scrollTop;C.on("scroll",this.onLiveScroll,this,{buffer:this.scrollDelay})}}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.JsonReader=function(A,B){Ext.ux.grid.livegrid.JsonReader.superclass.constructor.call(this,A,B)};Ext.extend(Ext.ux.grid.livegrid.JsonReader,Ext.data.JsonReader,{buildExtractors:function(){if(this.ef){return }var A=this.meta;if(A.versionProperty){this.getVersion=this.createAccessor(A.versionProperty)}Ext.ux.grid.livegrid.JsonReader.superclass.buildExtractors.call(this)},readRecords:function(C){if(!this.__readRecords){this.__readRecords=Ext.ux.grid.livegrid.JsonReader.superclass.readRecords}var B=this.__readRecords.call(this,C);if(this.meta.versionProperty){var A=this.getVersion(C);B.version=(A===undefined||A==="")?null:A}return B}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.RowSelectionModel=function(A){this.addEvents({selectiondirty:true});Ext.apply(this,A);this.pendingSelections={};Ext.ux.grid.livegrid.RowSelectionModel.superclass.constructor.call(this)};Ext.extend(Ext.ux.grid.livegrid.RowSelectionModel,Ext.grid.RowSelectionModel,{initEvents:function(){Ext.ux.grid.livegrid.RowSelectionModel.superclass.initEvents.call(this);this.grid.view.on("rowsinserted",this.onAdd,this);this.grid.store.on("selectionsload",this.onSelectionsLoad,this)},onRemove:function(B,D,G){var A=this.getPendingSelections();var C=A.length;var F=false;if(D==Number.MIN_VALUE||D==Number.MAX_VALUE){if(G){if(this.isIdSelected(G.id)&&D==Number.MIN_VALUE){this.shiftSelections(this.grid.store.bufferRange[1],-1)}this.selections.remove(G);F=true}if(D==Number.MIN_VALUE){this.clearPendingSelections(0,this.grid.store.bufferRange[0])}else{this.clearPendingSelections(this.grid.store.bufferRange[1])}if(C!=0){this.fireEvent("selectiondirty",this,D,1)}}else{F=this.isIdSelected(G.id);if(!F){return }this.selections.remove(G);if(C!=0){var H=A[0];var E=A[C-1];if(D<=E||D<=H){this.shiftSelections(D,-1);this.fireEvent("selectiondirty",this,D,1)}}}if(F){this.fireEvent("selectionchange",this)}},onAdd:function(G,E,D,B){var A=this.getPendingSelections();var H=A.length;if((E==Number.MIN_VALUE||E==Number.MAX_VALUE)){if(E==Number.MIN_VALUE){this.clearPendingSelections(0,this.grid.store.bufferRange[0]);this.shiftSelections(this.grid.store.bufferRange[1],B)}else{this.clearPendingSelections(this.grid.store.bufferRange[1])}if(H!=0){this.fireEvent("selectiondirty",this,E,r)}return }var F=A[0];var C=A[H-1];var I=E;if(I<=C||I<=F){this.fireEvent("selectiondirty",this,I,B);this.shiftSelections(I,B)}},shiftSelections:function(L,C){var H=0;var K=0;var B={};var D=this.grid.store;var I=L-D.bufferRange[0];var F=0;var M=this.grid.store.totalLength;var E=null;var A=this.getPendingSelections();var J=A.length;if(J==0){return }for(var G=0;G<J;G++){H=A[G];if(H<L){continue}K=H+C;F=I+C;if(K>=M){break}E=D.getAt(F);if(E){this.selections.add(E)}else{B[K]=true}}this.pendingSelections=B},onSelectionsLoad:function(C,B,A){this.replaceSelections(B)},hasNext:function(){return this.last!==false&&(this.last+1)<this.grid.store.getTotalCount()},getCount:function(){return this.selections.length+this.getPendingSelections().length},isSelected:function(A){if(typeof A=="number"){var B=A;A=this.grid.store.getAt(B);if(!A){var D=this.getPendingSelections().indexOf(B);if(D!=-1){return true}return false}}var C=A;return(C&&this.selections.key(C.id)?true:false)},deselectRecord:function(A,C){if(this.locked){return }var E=this.selections.key(A.id);if(!E){return }var B=this.grid.store;var D=B.indexOfId(A.id);if(D==-1){D=B.findInsertIndex(A);if(D!=Number.MIN_VALUE&&D!=Number.MAX_VALUE){D+=B.bufferRange[0]}}else{delete this.pendingSelections[D]}if(this.last==D){this.last=false}if(this.lastActive==D){this.lastActive=false}this.selections.remove(A);if(!C){this.grid.getView().onRowDeselect(D)}this.fireEvent("rowdeselect",this,D,A);this.fireEvent("selectionchange",this)},deselectRow:function(B,A){if(this.locked){return }if(this.last==B){this.last=false}if(this.lastActive==B){this.lastActive=false}var C=this.grid.store.getAt(B);delete this.pendingSelections[B];if(C){this.selections.remove(C)}if(!A){this.grid.getView().onRowDeselect(B)}this.fireEvent("rowdeselect",this,B,C);this.fireEvent("selectionchange",this)},selectRow:function(B,D,A){if(this.locked||B<0||B>=this.grid.store.getTotalCount()){return }var C=this.grid.store.getAt(B);if(this.fireEvent("beforerowselect",this,B,D,C)!==false){if(!D||this.singleSelect){this.clearSelections()}if(C){this.selections.add(C);delete this.pendingSelections[B]}else{this.pendingSelections[B]=true}this.last=this.lastActive=B;if(!A){this.grid.getView().onRowSelect(B)}this.fireEvent("rowselect",this,B,C);this.fireEvent("selectionchange",this)}},clearPendingSelections:function(G,F){if(F==undefined){F=Number.MAX_VALUE}var B={};var A=this.getPendingSelections();var D=A.length;var C=0;for(var E=0;E<D;E++){C=A[E];if(C<=F&&C>=G){continue}B[C]=true}this.pendingSelections=B},replaceSelections:function(E){if(!E||E.length==0){return }var D=this.grid.store;var F=null;var I=[];var A=this.getPendingSelections();var J=A.length;var C=this.selections;var H=0;for(var G=0;G<J;G++){H=A[G];F=D.getAt(H);if(F){C.add(F);I.push(F.id);delete this.pendingSelections[H]}}var B=null;for(G=0,len=E.length;G<len;G++){F=E[G];B=F.id;if(I.indexOf(B)==-1&&C.containsKey(B)){C.add(F)}}},getPendingSelections:function(F){var D=1;var C=[];var B=0;var G=[];for(var E in this.pendingSelections){G.push(parseInt(E))}G.sort(function(I,H){if(I>H){return 1}else{if(I<H){return -1}else{return 0}}});if(!F){return G}var A=G.length;if(A==0){return[]}C[B]=[G[0],G[0]];for(var E=0,A=A-1;E<A;E++){if(G[E+1]-G[E]==1){C[B][1]=G[E+1]}else{B++;C[B]=[G[E+1],G[E+1]]}}return C},clearSelections:function(A){if(this.locked){return }if(A!==true){var D=this.grid.store;var B=this.selections;var C=-1;B.each(function(E){C=D.indexOfId(E.id);if(C!=-1){this.deselectRow(C+D.bufferRange[0])}},this);B.clear();this.pendingSelections={}}else{this.selections.clear();this.pendingSelections={}}this.last=false},selectRange:function(B,A,D){if(this.locked){return }if(!D){this.clearSelections()}if(B<=A){for(var C=B;C<=A;C++){this.selectRow(C,true)}}else{for(var C=B;C>=A;C--){this.selectRow(C,true)}}}});Ext.namespace("Ext.ux.grid.livegrid");Ext.ux.grid.livegrid.Store=function(A){A=A||{};A.remoteSort=true;this._autoLoad=A.autoLoad?true:false;A.autoLoad=false;this.addEvents("bulkremove","versionchange","beforeselectionsload","selectionsload");Ext.ux.grid.livegrid.Store.superclass.constructor.call(this,A);this.totalLength=0;this.bufferRange=[-1,-1];this.on("clear",function(){this.bufferRange=[-1,-1]},this);if(this.url&&!this.selectionsProxy){this.selectionsProxy=new Ext.data.HttpProxy({url:this.url})}};Ext.extend(Ext.ux.grid.livegrid.Store,Ext.data.Store,{version:null,insert:function(D,C){C=[].concat(C);D=D>=this.bufferSize?Number.MAX_VALUE:D;if(D==Number.MIN_VALUE||D==Number.MAX_VALUE){var B=C.length;if(D==Number.MIN_VALUE){this.bufferRange[0]+=B;this.bufferRange[1]+=B}this.totalLength+=B;this.fireEvent("add",this,C,D);return }var F=false;var G=C;if(C.length+D>=this.bufferSize){F=true;G=C.splice(0,this.bufferSize-D)}this.totalLength+=G.length;if(this.bufferRange[0]<=-1){this.bufferRange[0]=0}if(this.bufferRange[1]<(this.bufferSize-1)){this.bufferRange[1]=Math.min(this.bufferRange[1]+G.length,this.bufferSize-1)}for(var E=0,A=G.length;E<A;E++){this.data.insert(D,G[E]);G[E].join(this)}while(this.getCount()>this.bufferSize){this.data.remove(this.data.last())}this.fireEvent("add",this,G,D);if(F==true){this.fireEvent("add",this,C,Number.MAX_VALUE)}},remove:function(B,A){var C=this._getIndex(B);if(C<0){this.totalLength-=1;if(this.pruneModifiedRecords){this.modified.remove(B)}this.bufferRange[0]=Math.max(-1,this.bufferRange[0]-1);this.bufferRange[1]=Math.max(-1,this.bufferRange[1]-1);if(A!==true){this.fireEvent("remove",this,B,C)}return C}this.bufferRange[1]=Math.max(-1,this.bufferRange[1]-1);this.data.removeAt(C);if(this.pruneModifiedRecords){this.modified.remove(B)}this.totalLength-=1;if(A!==true){this.fireEvent("remove",this,B,C)}return C},_getIndex:function(A){var B=this.indexOfId(A.id);if(B<0){B=this.findInsertIndex(A)}return B},bulkRemove:function(B){var G=null;var E=[];var D=0;var A=B.length;var F=[];for(var C=0;C<A;C++){G=B[C];F[G.id]=this._getIndex(G)}for(var C=0;C<A;C++){G=B[C];this.remove(G,true);E.push([G,F[G.id]])}this.fireEvent("bulkremove",this,E)},removeAll:function(){this.totalLength=0;this.bufferRange=[-1,-1];this.data.clear();if(this.pruneModifiedRecords){this.modified=[]}this.fireEvent("clear",this)},loadRanges:function(B){var A=B.length;if(A>0&&!this.selectionsProxy.activeRequest[Ext.data.Api.actions.read]&&this.fireEvent("beforeselectionsload",this,B)!==false){var E=this.lastOptions.params;var F={};F.ranges=Ext.encode(B);if(E){if(E.sort){F.sort=E.sort}if(E.dir){F.dir=E.dir}}var C={};for(var D in this.lastOptions){C.i=this.lastOptions.i}C.ranges=F.ranges;this.selectionsProxy.load(F,this.reader,this.selectionsLoaded,this,C)}},loadSelections:function(A){if(A.length==0){return }this.loadRanges(A)},selectionsLoaded:function(F,B,E){if(this.checkVersionChange(F,B,E)!==false){var D=F.records;for(var C=0,A=D.length;C<A;C++){D[C].join(this)}this.fireEvent("selectionsload",this,F.records,Ext.decode(B.ranges))}else{this.fireEvent("selectionsload",this,[],Ext.decode(B.ranges))}},checkVersionChange:function(D,B,C){if(D&&C!==false){if(D.version!==undefined){var A=this.version;this.version=D.version;if(this.version!==A){return this.fireEvent("versionchange",this,A,this.version)}}}},findInsertIndex:function(A){this.remoteSort=false;var B=Ext.ux.grid.livegrid.Store.superclass.findInsertIndex.call(this,A);this.remoteSort=true;if(this.bufferRange[0]<=0&&B==0){return B}else{if(this.bufferRange[0]>0&&B==0){return Number.MIN_VALUE}else{if(B>=this.bufferSize){return Number.MAX_VALUE}}}return B},sortData:function(C,D){D=D||"ASC";var A=this.fields.get(C).sortType;var B=function(F,E){var H=A(F.data[C]),G=A(E.data[C]);return H>G?1:(H<G?-1:0)};this.data.sort(D,B)},onMetaChange:function(B,A,C){this.version=null;Ext.ux.grid.livegrid.Store.superclass.onMetaChange.call(this,B,A,C)},loadRecords:function(C,A,B){this.checkVersionChange(C,A,B);if(!C){this.bufferRange=[-1,-1]}else{this.bufferRange=[A.params.start,Math.max(0,Math.min((A.params.start+A.params.limit)-1,C.totalRecords-1))]}if(A.suspendLoadEvent===true){this.suspendEvents()}Ext.ux.grid.livegrid.Store.superclass.loadRecords.call(this,C,A,B);if(A.suspendLoadEvent===true){this.resumeEvents()}},getAt:function(A){if(this.bufferRange[0]==-1){return undefined}var B=A-this.bufferRange[0];return this.data.itemAt(B)},clearFilter:function(){},isFiltered:function(){},collect:function(){},createFilterFn:function(){},sum:function(){},filter:function(){},filterBy:function(){},query:function(){},queryBy:function(){},find:function(){},findBy:function(){}}); -
trunk/build/resources/css/ext-ux-livegrid.css
r60 r68 1 .ext-ux-livegrid-drop-waiting{background-image:url(../images/loading.gif)!important;}.ext-ux-livegrid.ext-el-mask{z-index:0;}.ext-ux-livegrid -liveScroller{z-index:1;background:none!important;position:absolute;height:3px;right:0;width:18px;overflow:scroll;overflow-x:hidden;}.ext-ux-livegrid-liveScroller div{background:none;width:1px;overflow:hidden;font-size:1px;height:0;}1 .ext-ux-livegrid-drop-waiting{background-image:url(../images/loading.gif)!important;}.ext-ux-livegrid.ext-el-mask{z-index:0;}.ext-ux-livegrid .liveScroller{z-index:1;background:none!important;position:absolute;height:3px;right:0;width:18px;overflow:scroll;overflow-x:hidden;}.ext-ux-livegrid .liveScroller div{background:none;width:1px;overflow:hidden;font-size:1px;height:0;} -
trunk/CHANGELOG
r62 r68 1 V0.3.1 2 11-July 2009 3 - fixed: (GridView.js) load mask would steal focus from scrollbar in some broswers 4 - fixed: (GridView.js) (suspendLoadEvent) would not be properly reset after buffering, 5 which would not remove the loadMask 1 04-January-2010 2 - fixed: (GridView.js) fixed an issue where the grid would not be properly rendered 3 in IE due to deprecated "scrollOffset" property 4 - enhancement: (JsonReader.js) added compatibility for Ext 3.0.3 5 - enhancement: (GridView.js) replaced call to "Ext.each" in "processRows()" 6 with for-loop 7 - fixed: (GridView.js) added property "loadMaskDisplayed" to indicate whether 8 loadMask is currently being displayed; fixed an issue that would not stripe rows 9 when grid is being refreshed; 10 11 10-July 2009 12 - fixed: fixed an error that would be triggered if the store uses a custom proxy, 13 such as Ext.data.DirectProxy; introduced event "abortrequest" to be aware of cases 14 when custom proxies should abort any ongoing "read" server request 15 16 09-July 2009 17 - fixed: (EditorGridPanel.js, GridPanel.js) call in "initComponent()" would not allow 18 an user to set the property "cls"as it would get override; checked for existence of 19 this property and concatenated it with default 20 - enhancement: added Ext 3.0.0 compatibility 21 - fixed: (GridView.js) listener "onBeforeLoad()" now aborts any ongoing server 22 request and properly resets properties "isBuffering" and "isPreBuffering" 23 24 26-June 2009 25 - fixed: fixed an erroneous call to superclass' implementation of "initComponent()" 26 in Ext.ux.grid.livegrid.EditorGridPanel 27 28 20-June 2009 29 - fixed: fixed a bug where "suspendLoadEvent" would not be reset, thus suspending all 30 load-events for further calls once it was set 31 (see http://www.extjs.com/forum/showthread.php?p=345273#post345273) 32 - enhancement: added "examples" 33 - enhancement: enhanced css rules 34 - fixed: fixed a flaw which would remove focus from the scrollbar in IE7 by caching 35 the loadMask, which also speeds up rendering 36 - enhancement: performance improvements in "GridView.liveBufferUpdate()" by only 37 re-rendering the view if there is no index left in the request-queue 6 38 7 39 08-June 2009 8 - enhancement: removed "loadMaskConfig" property and instead delegated loadmask 40 - enhancement: (Store.js) updated api to work with Ext3.0RC2 (breaks backwards 41 compatibility with versions prior to Ext3.0Rc2) 42 - enhancement: (Toolbar.js) minor code changes to make toolbar work with Ext3.0RC2 43 - enhancement: (GridView.js) removed "loadMaskConfig" property and instead delegated loadmask 9 44 configuration to loadMask cfg property; simplified "showLoadMask" method 10 11 02-May-200912 - enhancement: allowed for re-rendering the rows if the store is pre-buffering13 - enhancement: "load" event from the store would still fire even if the store14 would only buffer; added "suspendLoadEvent" to the list of options so the store does suspend15 its events once a buffer finished (see http://www.extjs.com/forum/showthread.php?p=324046#post324046)16 17 Version 0.3 (GPL)18 02-May-200919 45 20 46 Version 0.3RC2 (GPL) -
trunk/src/EditorGridPanel.js
r36 r68 82 82 { 83 83 return Ext.ux.grid.livegrid.GridPanel.prototype.onRender.call(this, ct, position); 84 }, 85 86 initComponent : function() 87 { 88 if (this.cls) { 89 this.cls += ' ext-ux-livegrid'; 90 } else { 91 this.cls = 'ext-ux-livegrid'; 92 } 93 94 return Ext.ux.grid.livegrid.EditorGridPanel.superclass.initComponent.call(this); 84 95 } 85 96 -
trunk/src/GridPanel.js
r36 r68 35 35 */ 36 36 Ext.ux.grid.livegrid.GridPanel = Ext.extend(Ext.grid.GridPanel, { 37 38 initComponent : function() 39 { 40 if (this.cls) { 41 this.cls += ' ext-ux-livegrid'; 42 } else { 43 this.cls = 'ext-ux-livegrid'; 44 } 45 46 Ext.ux.grid.livegrid.GridPanel.superclass.initComponent.call(this); 47 }, 37 48 38 49 /** -
trunk/src/GridView.js
r60 r68 76 76 * @param {Number} totalCount 77 77 */ 78 'cursormove' : true 78 'cursormove' : true, 79 /** 80 * @event abortrequest 81 * Fires when the store is about to reload (this does NOT mean buffering). 82 * If you are using a custom proxy in your store, you should listen to this event 83 * and abort any ongoing server request established in your custom proxy. 84 * @param {Ext.data.Store} store 85 * @param {Object} options 86 */ 87 'abortrequest' : true 79 88 80 89 }); … … 113 122 this.horizontalScrollOffset = 17; 114 123 124 /** 125 * @type {Boolean} _checkEmptyBody Since Ext 3.0, would initially added to the mainBody 126 * as the first child if there are no rows to render. This element has to be removed when 127 * the first rows get added so the UI does not crash. This property is here to determine if 128 * this element was already removed, so we don't have to query innerHTML all the time. 129 */ 130 this._checkEmptyBody = true; 131 115 132 Ext.apply(this, config); 116 133 … … 121 138 */ 122 139 this.templates.master = new Ext.Template( 123 '<div class="x-grid3" hidefocus="true"><div class=" ext-ux-livegrid-liveScroller"><div></div></div>',140 '<div class="x-grid3" hidefocus="true"><div class="liveScroller"><div></div></div>', 124 141 '<div class="x-grid3-viewport"">', 125 '<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset" >{header}</div></div><div class="x-clear"></div></div>',126 '<div class="x-grid3-scroller" style="overflow-y:hidden !important;"><div class="x-grid3-body" >{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',142 '<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset" style="{ostyle}">{header}</div></div><div class="x-clear"></div></div>', 143 '<div class="x-grid3-scroller" style="overflow-y:hidden !important;"><div class="x-grid3-body" style="{bstyle}">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>', 127 144 "</div>", 128 145 '<div class="x-grid3-resize-marker"> </div>', … … 143 160 144 161 // {{{ --------------------------properties------------------------------------- 145 146 /**147 * Used to store the z-index of the mask that is used to show while buffering,148 * so the scrollbar can be displayed above of it.149 * @type {Number} _maskIndex150 */151 _maskIndex : 20001,152 162 153 163 /** … … 248 258 249 259 /** 260 * A shortcut to indicate whether the loadMask is currently being displayed. 261 * @type {Boolean} 262 * @private 263 */ 264 loadMaskDisplayed : false, 265 266 /** 250 267 * Set to <tt>true</tt> if a request for new data has been made while there 251 268 * are still rows in the buffer that can be rendered before the request … … 290 307 this.adjustScrollerPos(-this.liveScroller.dom.scrollTop, true); 291 308 this.showLoadMask(false); 309 310 var _ofn = this.processRows; 311 this.processRows = Ext.emptyFn; 292 312 this.refresh(true); 293 //this.replaceLiveRows(0, true); 313 this.processRows = _ofn; 314 this.processRows(0); 315 294 316 this.fireEvent('cursormove', this, 0, 295 317 Math.min(this.ds.totalLength, this.visibleRows-this.rowClipped), … … 314 336 315 337 // {{{ ------------adjusted methods for applying custom behavior---------------- 338 316 339 /** 317 340 * Overwritten so the {@link Ext.ux.grid.livegrid.DragZone} can be used … … 351 374 this._loadMaskAnchor.mask( 352 375 this.loadMask.msg, this.loadMask.msgCls 353 ); 354 this._loadMaskAnchor._mask.addClass('ext-ux-livegrid'); 355 this._loadMaskAnchor._mask.setDisplayed(false); 356 this._loadMaskAnchor._maskMsg.setDisplayed(false); 376 ); 377 var dom = this._loadMaskAnchor.dom; 378 var data = Ext.Element.data; 379 data(dom, 'mask').addClass('ext-ux-livegrid'); 380 data(dom, 'mask').setDisplayed(false); 381 data(dom, 'maskMsg').setDisplayed(false); 357 382 } 358 383 }, … … 487 512 var vw = csize.width; 488 513 489 if( vw < 20 || csize.height < 20){ // display: none?514 if(!g.hideHeaders && vw < 20 || csize.height < 20){ // display: none? 490 515 return; 491 516 } … … 493 518 if(g.autoHeight){ 494 519 this.scroller.dom.style.overflow = 'visible'; 520 if(Ext.isWebKit){ 521 this.scroller.dom.style.position = 'static'; 522 } 495 523 }else{ 496 524 this.el.setSize(csize.width, csize.height); … … 569 597 this.updateHeaderSortState(); 570 598 this.afterMove(newIndex); 599 this.grid.fireEvent('columnmove', oldIndex, newIndex); 571 600 }, 572 601 … … 605 634 } 606 635 607 this.addRowClass(row, "x-grid3-row-selected");636 this.addRowClass(row, this.selectedRowClass); 608 637 }, 609 638 … … 620 649 } 621 650 622 this.removeRowClass(row, "x-grid3-row-selected");651 this.removeRowClass(row, this.selectedRowClass); 623 652 }, 624 653 … … 740 769 onAdd : function(ds, records, index) 741 770 { 771 if (this._checkEmptyBody) { 772 if (this.mainBody.dom.innerHTML == ' ') { 773 this.mainBody.dom.innerHTML = ''; 774 } 775 this._checkEmptyBody = false; 776 } 777 742 778 var recordLen = records.length; 743 779 … … 847 883 * All other load events will be suspended when the view requests buffer data. 848 884 * See {updateLiveRows}. 885 * Note: 886 * If you are using a custom proxy, such as {Ext.data.DirectProxy}, you should listen 887 * to the 'abortrequest'-event, which will tell that an ongoing "read" request should be 888 * aborted, since the grid's store gets refreshed. 889 * If the store is using an instance of {Ext.data.HttpProxy}, the method will still be 890 * fired, but the request made through this proxy will be aborted automatically. 891 * 849 892 * 850 893 * @param {Ext.data.Store} store The store the Grid Panel uses … … 854 897 onBeforeLoad : function(store, options) 855 898 { 899 var proxy = store.proxy; 900 if (proxy.activeRequest && proxy.activeRequest[Ext.data.Api.actions.read]) { 901 proxy.getConnection().abort(proxy.activeRequest[Ext.data.Api.actions.read]); 902 } 903 this.fireEvent('abortrequest', store, options); 904 905 this.isBuffering = false; 906 this.isPreBuffering = false; 907 856 908 options.params = options.params || {}; 857 909 … … 929 981 ); 930 982 931 this.isBuffering = false;932 this.isPrebuffering = false;933 this.showLoadMask(false);934 935 983 // this is needed since references to records which have been unloaded 936 984 // get lost when the store gets loaded with new data. … … 938 986 this.grid.selModel.replaceSelections(records); 939 987 988 this.isBuffering = false; 989 this.isPrebuffering = false; 990 this.showLoadMask(false); 991 992 if (this.requestQueue >= 0) { 993 var offset = this.requestQueue; 994 this.requestQueue = -1; 995 this.updateLiveRows(offset); 996 return; 997 } 940 998 941 999 if (this.isInRange(this.rowIndex)) { … … 945 1003 } 946 1004 947 if (this.requestQueue >= 0) {948 var offset = this.requestQueue;949 this.requestQueue = -1;950 this.updateLiveRows(offset);951 }952 1005 953 1006 return; … … 1033 1086 }, 1034 1087 1088 1035 1089 /** 1036 1090 * Overwritten so the rowIndex can be changed to the absolute index. … … 1042 1096 processRows : function(startRow, skipStripe, paintSelections) 1043 1097 { 1098 if(!this.ds || this.ds.getCount() < 1){ 1099 return; 1100 } 1101 1044 1102 skipStripe = skipStripe || !this.grid.stripeRows; 1045 // we will always process all rows in the view 1046 startRow = 0; 1047 var rows = this.getRows(); 1048 var cls = ' x-grid3-row-alt '; 1049 var cursor = this.rowIndex; 1050 1103 1104 var cursor = this.rowIndex; 1105 var rows = this.getRows(); 1051 1106 var index = 0; 1052 var selections = this.grid.selModel.selections; 1053 var ds = this.ds; 1054 var row = null; 1055 for(var i = startRow, len = rows.length; i < len; i++){ 1056 index = i+cursor; 1057 row = rows[i]; 1058 // changed! 1059 row.rowIndex = index; 1107 1108 var row = null; 1109 for (var idx = 0, len = rows.length; idx < len; idx++) { 1110 row = rows[idx]; 1111 1112 row.rowIndex = index = cursor+idx; 1113 row.className = row.className.replace(this.rowClsRe, ' '); 1114 if (!skipStripe && (index + 1) % 2 === 0) { 1115 row.className += ' x-grid3-row-alt'; 1116 } 1060 1117 1061 1118 if (paintSelections !== false) { 1062 1119 if (this.grid.selModel.isSelected(this.ds.getAt(index)) === true) { 1063 this.addRowClass(index, "x-grid3-row-selected");1120 this.addRowClass(index, this.selectedRowClass); 1064 1121 } else { 1065 this.removeRowClass(index, "x-grid3-row-selected");1122 this.removeRowClass(index, this.selectedRowClass); 1066 1123 } 1067 1124 this.fly(row).removeClass("x-grid3-row-over"); 1068 1125 } 1069 1070 if(!skipStripe){ 1071 var isAlt = ((index+1) % 2 == 0); 1072 var hasAlt = (' '+row.className + ' ').indexOf(cls) != -1; 1073 if(isAlt == hasAlt){ 1074 continue; 1075 } 1076 if(isAlt){ 1077 row.className += " x-grid3-row-alt"; 1078 }else{ 1079 row.className = row.className.replace("x-grid3-row-alt", ""); 1080 } 1081 } 1126 } 1127 1128 // add first/last-row classes 1129 if(cursor === 0){ 1130 Ext.fly(rows[0]).addClass(this.firstRowCls); 1131 } else if (cursor + rows.length == this.ds.totalLength) { 1132 Ext.fly(rows[rows.length - 1]).addClass(this.lastRowCls); 1082 1133 } 1083 1134 }, … … 1469 1520 showLoadMask : function(show) 1470 1521 { 1471 if (!this.loadMask) { 1472 return; 1473 } 1474 1475 var mask = this._loadMaskAnchor._mask; 1476 var maskMsg = this._loadMaskAnchor._maskMsg; 1522 if (!this.loadMask || show == this.loadMaskDisplayed) { 1523 return; 1524 } 1525 1526 var dom = this._loadMaskAnchor.dom; 1527 var data = Ext.Element.data; 1528 1529 var mask = data(dom, 'mask'); 1530 var maskMsg = data(dom, 'maskMsg'); 1477 1531 1478 1532 if (show) { … … 1482 1536 // this lines will help IE8 to re-calculate the height of the loadmask 1483 1537 if(Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && this._loadMaskAnchor.getStyle('height') == 'auto'){ 1484 mask.setSize(undefined, this._loadMaskAnchor.getHeight());1485 }1538 mask.setSize(undefined, this._loadMaskAnchor.getHeight()); 1539 } 1486 1540 } else { 1487 1541 mask.setDisplayed(false); 1488 1542 maskMsg.setDisplayed(false); 1489 1543 } 1544 1545 this.loadMaskDisplayed = show; 1490 1546 }, 1491 1547 … … 1590 1646 return; 1591 1647 } else { 1592 this.scroller.setWidth(elWidth-this. scrollOffset);1648 this.scroller.setWidth(elWidth-this.getScrollOffset()); 1593 1649 liveScrollerDom.style.display = ''; 1594 1650 } 1595 1651 1596 var scrollbar = this.cm.getTotalWidth()+this. scrollOffset> elWidth;1652 var scrollbar = this.cm.getTotalWidth()+this.getScrollOffset() > elWidth; 1597 1653 1598 1654 // adjust the height of the scrollbar … … 1644 1700 var vh = size.height; 1645 1701 1646 var vw = width-this. scrollOffset;1702 var vw = width-this.getScrollOffset(); 1647 1703 // horizontal scrollbar shown? 1648 1704 if (cm.getTotalWidth() > vw) { -
trunk/src/JsonReader.js
r31 r68 48 48 */ 49 49 50 buildExtractors : function() 51 { 52 if(this.ef){ 53 return; 54 } 50 55 56 var s = this.meta; 57 58 if(s.versionProperty) { 59 this.getVersion = this.createAccessor(s.versionProperty); 60 } 61 62 Ext.ux.grid.livegrid.JsonReader.superclass.buildExtractors.call(this); 63 }, 51 64 52 65 /** … … 60 73 readRecords : function(o) 61 74 { 62 var s = this.meta;63 64 if(!this.ef && s.versionProperty) {65 this.getVersion = this.getJsonAccessor(s.versionProperty);66 }67 68 75 // shorten for future calls 69 76 if (!this.__readRecords) { 70 77 this.__readRecords = Ext.ux.grid.livegrid.JsonReader.superclass.readRecords; 71 78 } 72 73 79 var intercept = this.__readRecords.call(this, o); 74 80 75 76 if (s.versionProperty) { 81 if (this.meta.versionProperty) { 77 82 var v = this.getVersion(o); 78 83 intercept.version = (v === undefined || v === "") ? null : v; 79 84 } 80 81 85 82 86 return intercept; -
trunk/src/resources/css/ext-ux-livegrid.css
r60 r68 7 7 } 8 8 9 .ext-ux-livegrid -liveScroller {9 .ext-ux-livegrid .liveScroller { 10 10 z-index:1; 11 11 background:none!important; … … 18 18 } 19 19 20 .ext-ux-livegrid -liveScroller div {20 .ext-ux-livegrid .liveScroller div { 21 21 background:none; 22 22 width:1px; -
trunk/src/Store.js
r43 r68 391 391 var max_i = ranges.length; 392 392 393 if(max_i > 0 && !this.selectionsProxy.activeRequest 393 if(max_i > 0 && !this.selectionsProxy.activeRequest[Ext.data.Api.actions.read] 394 394 && this.fireEvent("beforeselectionsload", this, ranges) !== false){ 395 395 -
trunk/src/Toolbar.js
r33 r68 218 218 Ext.PagingToolbar.superclass.onRender.call(this, ct, position); 219 219 220 this.loading = this.addButton({220 this.loading = new Ext.Toolbar.Button({ 221 221 tooltip : this.refreshText, 222 222 iconCls : "x-tbar-loading", … … 224 224 }); 225 225 226 this.addButton(this.loading); 227 226 228 this.addSeparator(); 227 229
