Changeset 79 for trunk

Show
Ignore:
Timestamp:
02/09/11 21:21:32 (15 months ago)
Author:
tsuckow
Message:
  • fixed: (GridView?.js) fixed an issue where selections not currently in the buffer would get accidently removed once the grid gets reset
  • enhancement: added CheckboxSelectionModel?.js to be able to use a checkboxselection with Ext.ux.Livegrid
Location:
trunk
Files:
5 added
9 modified

Legend:

Unmodified
Added
Removed
  • trunk/build-tools/unix/make.sh

    r38 r79  
    1818        TP="../../" 
    1919        yuicompressor_path=$1 
    20         livegrid_file_list_core="${TP}src/GridPanel.js+${TP}src/GridView.js+${TP}src/JsonReader.js+${TP}src/RowSelectionModel.js+${TP}src/Store.js" 
     20        livegrid_file_list_core="${TP}src/GridPanel.js+${TP}src/GridView.js+${TP}src/JsonReader.js+${TP}src/RowSelectionModel.js+${TP}src/Store.js+${TP}src/CheckboxSelectionModel.js" 
    2121        livegrid_file_list_all="${livegrid_file_list_core}+${TP}src/Toolbar.js+{TP}src/DragZone.js+${TP}src/EditorGridPanel.js" 
    2222 
  • trunk/build-tools/windows/make.bat

    r38 r79  
    1818:process 
    1919set tp=..\..\ 
    20 set livegrid_file_list_core=%tp%src\GridPanel.js+%tp%src\GridView.js+%tp%src\JsonReader.js+%tp%src\RowSelectionModel.js+%tp%src\Store.js 
     20set livegrid_file_list_core=%tp%src\GridPanel.js+%tp%src\GridView.js+%tp%src\JsonReader.js+%tp%src\RowSelectionModel.js+%tp%src\Store.js+%tp%src\CheckboxSelectionModel.js 
    2121set livegrid_file_list_all=%livegrid_file_list_core%+%tp%src\Toolbar.js+%tp%src\DragZone.js+%tp%src\EditorGridPanel.js 
    2222 
  • trunk/build/livegrid-all-debug.js

    r73 r79  
    122122 
    123123    this.addEvents({ 
     124        /** 
     125         * @event reset 
     126         * Fires when the grid resets. 
     127         * @param {Ext.ux.grid.livegrid.GridView} this 
     128         * @param {Boolean} forceReload 
     129         */ 
     130        'reset' : true, 
    124131        /** 
    125132         * @event beforebuffer 
     
    397404            var _ofn = this.processRows; 
    398405            this.processRows = Ext.emptyFn; 
     406            this.suspendEvents(); 
    399407            this.refresh(true); 
     408            this.resumeEvents(); 
    400409            this.processRows = _ofn; 
    401410            this.processRows(0); 
     
    404413                           Math.min(this.ds.totalLength, this.visibleRows-this.rowClipped), 
    405414                           this.ds.totalLength); 
     415            this.fireEvent('reset', this, forceReload); 
    406416            return false; 
    407417        } else { 
     
    417427            } 
    418428 
     429            this.fireEvent('reset', this, forceReload); 
    419430            return this.ds.load({params : params}); 
    420431        } 
     
    423434 
    424435// {{{ ------------adjusted methods for applying custom behavior---------------- 
    425  
    426     // private 
    427     render : function() { 
    428         if (this.autoFill) { 
    429             var ct = this.grid.ownerCt; 
    430  
    431             if (ct && ct.getLayout()) { 
    432                 ct.on('afterlayout', function() { 
    433                     this.fitColumns(true, true); 
    434                     this.updateHeaders(); 
    435                     this.updateHeaderSortState(); 
    436                 }, this, {single: true}); 
    437             } 
    438         } else if (this.forceFit) { 
    439             this.fitColumns(true, false); 
    440         } else if (this.grid.autoExpandColumn) { 
    441             this.autoExpand(true); 
    442         } 
    443  
    444         this.grid.getGridEl().dom.innerHTML = this.renderUI(); 
    445  
    446         this.afterRenderUI(); 
    447     }, 
    448436 
    449437    /** 
     
    12241212        skipStripe = skipStripe || !this.grid.stripeRows; 
    12251213 
    1226         var cursor     = this.rowIndex; 
    1227         var rows       = this.getRows(); 
    1228         var index      = 0; 
     1214        var cursor      = this.rowIndex; 
     1215        var rows        = this.getRows(); 
     1216        var index       = 0; 
     1217        var sm          = this.grid.selModel; 
     1218        var allSelected = sm.isAllSelected(); 
    12291219 
    12301220        var row = null; 
     
    12391229 
    12401230            if (paintSelections !== false) { 
    1241                 if (this.grid.selModel.isSelected(this.ds.getAt(index)) === true) { 
     1231                if (sm.isSelected(this.ds.getAt(index)) === true) { 
    12421232                    this.addRowClass(index, this.selectedRowClass); 
    12431233                } else { 
     
    20422032    Ext.apply(this, config); 
    20432033 
     2034    this.allSelected = false; 
     2035    this.excludes    = []; 
     2036 
    20442037    this.pendingSelections = {}; 
    20452038 
     
    22922285 
    22932286        var r = index; 
     2287 
     2288        if (this.allSelected && !this.excludes[r.id]) { 
     2289            return true; 
     2290        } 
     2291 
    22942292        return (r && this.selections.key(r.id) ? true : false); 
    22952293    }, 
     
    23112309        if (!isSelected) { 
    23122310            return; 
     2311        } 
     2312 
     2313        if (this.allSelected) { 
     2314            this.excludes[record.id] = true; 
    23132315        } 
    23142316 
     
    23642366 
    23652367        if (r) { 
     2368            if (this.allSelected) { 
     2369                this.excludes[r.id] = true; 
     2370            } 
    23662371            this.selections.remove(r); 
    23672372        } 
     
    23992404                this.selections.add(r); 
    24002405                delete this.pendingSelections[index]; 
     2406                delete this.excludes[r.id]; 
    24012407            } else { 
    24022408                this.pendingSelections[index] = true; 
     
    25512557        } 
    25522558        this.last = false; 
     2559        this.allSelected = false; 
     2560        this.excludes = []; 
    25532561    }, 
    25542562 
     
    25822590        } 
    25832591 
     2592    }, 
     2593 
     2594    /** 
     2595     * Returns true if all rows available are selected. 
     2596     */ 
     2597    isAllSelected : function() 
     2598    { 
     2599        return this.allSelected; 
     2600    }, 
     2601 
     2602    /** 
     2603     * Selects all rows if the selection model 
     2604     * {@link Ext.grid.AbstractSelectionModel#isLocked is not locked}. 
     2605     */ 
     2606    selectAll : function() 
     2607    { 
     2608        if(this.isLocked()){ 
     2609            return; 
     2610        } 
     2611 
     2612        this.excludes = []; 
     2613        this.selectRange(0, this.grid.store.getTotalCount(), false); 
     2614        this.allSelected = true; 
     2615    }, 
     2616 
     2617    /** 
     2618     * Returns an object with all records currently being excluded, 
     2619     * whereas the key is the id of the record, and it's value is 
     2620     * set to boolean true. 
     2621     */ 
     2622    getExcludes : function() 
     2623    { 
     2624        return this.excludes; 
    25842625    } 
     2626 
     2627 
    25852628 
    25862629}); 
     
    31923235 
    31933236});/** 
     3237 * Ext.ux.grid.livegrid.CheckboxSelectionModel 
     3238 * Copyright (c) 2007-2008, http://www.siteartwork.de 
     3239 * 
     3240 * Ext.ux.grid.livegrid.CheckboxSelectionModel is licensed under the terms of the 
     3241 *                  GNU Open Source GPL 3.0 
     3242 * license. 
     3243 * 
     3244 * Commercial use is prohibited. Visit <http://www.siteartwork.de/livegrid> 
     3245 * if you need to obtain a commercial license. 
     3246 * 
     3247 * This program is free software: you can redistribute it and/or modify it under 
     3248 * the terms of the GNU General Public License as published by the Free Software 
     3249 * Foundation, either version 3 of the License, or any later version. 
     3250 * 
     3251 * This program is distributed in the hope that it will be useful, but WITHOUT 
     3252 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
     3253 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 
     3254 * details. 
     3255 * 
     3256 * You should have received a copy of the GNU General Public License along with 
     3257 * this program. If not, see <http://www.gnu.org/licenses/gpl.html>. 
     3258 * 
     3259 */ 
     3260 
     3261Ext.namespace('Ext.ux.grid.livegrid'); 
     3262 
     3263/** 
     3264 * @class Ext.ux.grid.livegrid.CheckboxSelectionModel 
     3265 * @extends Ext.ux.grid.livegrid.RowSelectionModel 
     3266 * @constructor 
     3267 * @param {Object} config 
     3268 * 
     3269 * @author Thorsten Suckow-Homberg <ts@siteartwork.de> 
     3270 */ 
     3271Ext.ux.grid.livegrid.CheckboxSelectionModel = Ext.extend(Ext.ux.grid.livegrid.RowSelectionModel, { 
     3272 
     3273    /** 
     3274     * @cfg {Boolean} checkOnly <tt>true</tt> if rows can only be selected by clicking on the 
     3275     * checkbox column (defaults to <tt>false</tt>). 
     3276     */ 
     3277    /** 
     3278     * @cfg {Number} width The default width in pixels of the checkbox column (defaults to <tt>20</tt>). 
     3279     */ 
     3280    width : 20, 
     3281 
     3282    // private 
     3283    menuDisabled : true, 
     3284    sortable : false, 
     3285    fixed : true, 
     3286    dataIndex : '', 
     3287    id : 'checker', 
     3288    headerCheckbox : null, 
     3289    markAll : false, 
     3290 
     3291    constructor : function() 
     3292    { 
     3293        if (!this.header) { 
     3294            this.header = Ext.grid.CheckboxSelectionModel.prototype.header; 
     3295        } 
     3296 
     3297        this.sortable = false; 
     3298 
     3299        Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.constructor.call(this); 
     3300    }, 
     3301 
     3302    // private 
     3303    initEvents : function() 
     3304    { 
     3305        Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.initEvents.call(this); 
     3306 
     3307        this.grid.view.on('reset', function(gridView, forceReload) { 
     3308                this.headerCheckbox = new Ext.Element( 
     3309                    gridView.getHeaderCell(this.grid.getColumnModel().getIndexById(this.id)).firstChild 
     3310                ); 
     3311                if (this.markAll && forceReload === false) { 
     3312                    this.headerCheckbox.addClass('x-grid3-hd-checker-on'); 
     3313                } 
     3314        }, this); 
     3315 
     3316        Ext.grid.CheckboxSelectionModel.prototype.initEvents.call(this); 
     3317    }, 
     3318 
     3319    // private 
     3320    onMouseDown : function(e, t) 
     3321    { 
     3322        if(e.button === 0 && t.className == 'x-grid3-row-checker') { 
     3323            e.stopEvent(); 
     3324            var row = e.getTarget('.x-grid3-row'); 
     3325            if(row){ 
     3326                if (this.headerCheckbox) { 
     3327                    this.markAll = false; 
     3328                    this.headerCheckbox.removeClass('x-grid3-hd-checker-on'); 
     3329                } 
     3330            } 
     3331        } 
     3332 
     3333        return Ext.grid.CheckboxSelectionModel.prototype.onMouseDown.call(this, e, t); 
     3334    }, 
     3335 
     3336    // private 
     3337    onHdMouseDown : function(e, t) 
     3338    { 
     3339        if (t.className == 'x-grid3-hd-checker' && !this.headerCheckbox) { 
     3340            this.headerCheckbox = new Ext.Element(t.parentNode); 
     3341        } 
     3342 
     3343        return Ext.grid.CheckboxSelectionModel.prototype.onHdMouseDown.call(this, e, t); 
     3344    }, 
     3345 
     3346    // private 
     3347    renderer : function(v, p, record) 
     3348    { 
     3349        return Ext.grid.CheckboxSelectionModel.prototype.renderer.call(this, v, p, record); 
     3350    }, 
     3351 
     3352// -------- overrides 
     3353 
     3354    /** 
     3355     * Overriden to prevent selections by shift-clicking 
     3356     */ 
     3357    handleMouseDown : function(g, rowIndex, e) 
     3358    { 
     3359        if (e.shiftKey) { 
     3360            return; 
     3361        } 
     3362 
     3363        this.markAll = false; 
     3364 
     3365        if (this.headerCheckbox) { 
     3366            this.headerCheckbox.removeClass('x-grid3-hd-checker-on'); 
     3367        } 
     3368 
     3369        Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.handleMouseDown.call(this, g, rowIndex, e); 
     3370    }, 
     3371 
     3372    /** 
     3373     * Overriden to clear header sort state 
     3374     */ 
     3375    clearSelections : function(fast) 
     3376    { 
     3377        if(this.isLocked()){ 
     3378            return; 
     3379        } 
     3380 
     3381        this.markAll = false; 
     3382 
     3383        if (this.headerCheckbox) { 
     3384            this.headerCheckbox.removeClass('x-grid3-hd-checker-on'); 
     3385        } 
     3386 
     3387        Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.clearSelections.call(this, fast); 
     3388    }, 
     3389 
     3390    /** 
     3391     * Selects all rows if the selection model 
     3392     * {@link Ext.grid.AbstractSelectionModel#isLocked is not locked}. 
     3393     */ 
     3394    selectAll : function() 
     3395    { 
     3396        Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.selectAll.call(this); 
     3397 
     3398        this.markAll = true; 
     3399 
     3400        if (this.headerCheckbox) { 
     3401            this.headerCheckbox.addClass('x-grid3-hd-checker-on'); 
     3402        } 
     3403    } 
     3404 
     3405 
     3406});/** 
    31943407 * Ext.ux.grid.livegrid.Toolbar 
    31953408 * Copyright (c) 2007-2008, http://www.siteartwork.de 
  • trunk/build/livegrid-all.js

    r73 r79  
    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><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">&#160;</div>','<div class="x-grid3-resize-proxy">&#160;</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,liveScrollerInsets: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})}},render:function(){if(this.autoFill){var A=this.grid.ownerCt;if(A&&A.getLayout()){A.on("afterlayout",function(){this.fitColumns(true,true);this.updateHeaders();this.updateHeaderSortState()},this,{single:true})}}else{if(this.forceFit){this.fitColumns(true,false)}else{if(this.grid.autoExpandColumn){this.autoExpand(true)}}}this.grid.getGridEl().dom.innerHTML=this.renderUI();this.afterRenderUI()},renderUI:function(){var B=this.grid;var C=B.enableDragDrop||B.enableDrag;B.enableDragDrop=false;B.enableDrag=false;var A=this._gridViewSuperclass.renderUI.call(this);var B=this.grid;B.enableDragDrop=C;B.enableDrag=C;if(C){this.dragZone=new Ext.ux.grid.livegrid.DragZone(B,{ddGroup:B.ddGroup||"GridDD"})}return A},afterRenderUI:function(){this._gridViewSuperclass.afterRenderUI.call(this);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 B=this._loadMaskAnchor.dom;var A=Ext.Element.data;A(B,"mask").addClass("ext-ux-livegrid");A(B,"mask").setDisplayed(false);A(B,"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 F=Ext.Element;var B=this.grid.getGridEl().dom.firstChild;var A=B.childNodes;this.el=new F(B);this.mainWrap=new F(A[1]);this.liveScroller=new F(A[0]);var D=this.liveScroller.dom.firstChild;this.liveScrollerInsets=[D,D.nextSibling,D.nextSibling.nextSibling];this.liveScroller.on("scroll",this.onLiveScroll,this,{buffer:this.scrollDelay});var C=this.mainWrap.dom.firstChild;this.mainHd=new F(C);this.hdHeight=C.offsetHeight;this.innerHd=this.mainHd.dom.firstChild;this.scroller=new F(this.mainWrap.dom.childNodes[1]);if(this.forceFit){this.scroller.setStyle("overflow-x","hidden")}this.mainBody=new F(this.scroller.dom.firstChild);this.mainBody.on("mousewheel",this.handleWheel,this);this.focusEl=new F(this.scroller.dom.childNodes[1]);this.focusEl.swallowEvent("click",true);this.resizeMarker=new F(A[2]);this.resizeProxy=new F(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=="&nbsp;"){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 H=this.liveScroller.dom;var E=this.grid,B=E.store;var G=E.getGridEl();var K=G.getSize().width;var A=(B.totalLength==this.visibleRows-this.rowClipped)?0:Math.max(0,B.totalLength-(this.visibleRows-this.rowClipped));if(A==0){this.scroller.setWidth(K);H.style.display="none";return }else{this.scroller.setWidth(K-this.getScrollOffset());H.style.display=""}var L=this.cm.getTotalWidth()+this.getScrollOffset()>K;var J=H.parentNode.offsetHeight+((B.totalLength>0&&L)?-this.horizontalScrollOffset:0)-this.hdHeight;H.style.height=Math.max(J,this.horizontalScrollOffset*2)+"px";if(this.rowHeight==-1){return }var D=(A==0?0:J+(A*this.rowHeight));var I=D;var F=this.liveScrollerInsets.length;if(D==0){D=0}else{D=Math.round(D/F)}for(var C=0;C<F;C++){if(C==F-1&&D!=0){D-=(D*3)-I}this.liveScrollerInsets[C].style.height=D+"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.doRequest(Ext.data.Api.actions.read,null,C,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)}}); 
     1Ext.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({reset:true,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><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">&#160;</div>','<div class="x-grid3-resize-proxy">&#160;</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,liveScrollerInsets: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.suspendEvents();this.refresh(true);this.resumeEvents();this.processRows=B;this.processRows(0);this.fireEvent("cursormove",this,0,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);this.fireEvent("reset",this,D);return false}else{var C={};var A=this.ds.sortInfo;if(A){C={dir:A.direction,sort:A.field}}this.fireEvent("reset",this,D);return this.ds.load({params:C})}},renderUI:function(){var B=this.grid;var C=B.enableDragDrop||B.enableDrag;B.enableDragDrop=false;B.enableDrag=false;var A=this._gridViewSuperclass.renderUI.call(this);var B=this.grid;B.enableDragDrop=C;B.enableDrag=C;if(C){this.dragZone=new Ext.ux.grid.livegrid.DragZone(B,{ddGroup:B.ddGroup||"GridDD"})}return A},afterRenderUI:function(){this._gridViewSuperclass.afterRenderUI.call(this);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 B=this._loadMaskAnchor.dom;var A=Ext.Element.data;A(B,"mask").addClass("ext-ux-livegrid");A(B,"mask").setDisplayed(false);A(B,"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 F=Ext.Element;var B=this.grid.getGridEl().dom.firstChild;var A=B.childNodes;this.el=new F(B);this.mainWrap=new F(A[1]);this.liveScroller=new F(A[0]);var D=this.liveScroller.dom.firstChild;this.liveScrollerInsets=[D,D.nextSibling,D.nextSibling.nextSibling];this.liveScroller.on("scroll",this.onLiveScroll,this,{buffer:this.scrollDelay});var C=this.mainWrap.dom.firstChild;this.mainHd=new F(C);this.hdHeight=C.offsetHeight;this.innerHd=this.mainHd.dom.firstChild;this.scroller=new F(this.mainWrap.dom.childNodes[1]);if(this.forceFit){this.scroller.setStyle("overflow-x","hidden")}this.mainBody=new F(this.scroller.dom.firstChild);this.mainBody.on("mousewheel",this.handleWheel,this);this.focusEl=new F(this.scroller.dom.childNodes[1]);this.focusEl.swallowEvent("click",true);this.resizeMarker=new F(A[2]);this.resizeProxy=new F(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=="&nbsp;"){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(H,E,B){if(!this.ds||this.ds.getCount()<1){return }E=E||!this.grid.stripeRows;var I=this.rowIndex;var K=this.getRows();var D=0;var A=this.grid.selModel;var G=A.isAllSelected();var J=null;for(var F=0,C=K.length;F<C;F++){J=K[F];J.rowIndex=D=I+F;J.className=J.className.replace(this.rowClsRe," ");if(!E&&(D+1)%2===0){J.className+=" x-grid3-row-alt"}if(B!==false){if(A.isSelected(this.ds.getAt(D))===true){this.addRowClass(D,this.selectedRowClass)}else{this.removeRowClass(D,this.selectedRowClass)}this.fly(J).removeClass("x-grid3-row-over")}}if(I===0){Ext.fly(K[0]).addClass(this.firstRowCls)}else{if(I+K.length==this.ds.totalLength){Ext.fly(K[K.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 H=this.liveScroller.dom;var E=this.grid,B=E.store;var G=E.getGridEl();var K=G.getSize().width;var A=(B.totalLength==this.visibleRows-this.rowClipped)?0:Math.max(0,B.totalLength-(this.visibleRows-this.rowClipped));if(A==0){this.scroller.setWidth(K);H.style.display="none";return }else{this.scroller.setWidth(K-this.getScrollOffset());H.style.display=""}var L=this.cm.getTotalWidth()+this.getScrollOffset()>K;var J=H.parentNode.offsetHeight+((B.totalLength>0&&L)?-this.horizontalScrollOffset:0)-this.hdHeight;H.style.height=Math.max(J,this.horizontalScrollOffset*2)+"px";if(this.rowHeight==-1){return }var D=(A==0?0:J+(A*this.rowHeight));var I=D;var F=this.liveScrollerInsets.length;if(D==0){D=0}else{D=Math.round(D/F)}for(var C=0;C<F;C++){if(C==F-1&&D!=0){D-=(D*3)-I}this.liveScrollerInsets[C].style.height=D+"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.allSelected=false;this.excludes=[];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;if(this.allSelected&&!this.excludes[C.id]){return true}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 }if(this.allSelected){this.excludes[A.id]=true}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){if(this.allSelected){this.excludes[C.id]=true}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];delete this.excludes[C.id]}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;this.allSelected=false;this.excludes=[]},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)}}},isAllSelected:function(){return this.allSelected},selectAll:function(){if(this.isLocked()){return }this.excludes=[];this.selectRange(0,this.grid.store.getTotalCount(),false);this.allSelected=true},getExcludes:function(){return this.excludes}});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.doRequest(Ext.data.Api.actions.read,null,C,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.CheckboxSelectionModel=Ext.extend(Ext.ux.grid.livegrid.RowSelectionModel,{width:20,menuDisabled:true,sortable:false,fixed:true,dataIndex:"",id:"checker",headerCheckbox:null,markAll:false,constructor:function(){if(!this.header){this.header=Ext.grid.CheckboxSelectionModel.prototype.header}this.sortable=false;Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.constructor.call(this)},initEvents:function(){Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.initEvents.call(this);this.grid.view.on("reset",function(A,B){this.headerCheckbox=new Ext.Element(A.getHeaderCell(this.grid.getColumnModel().getIndexById(this.id)).firstChild);if(this.markAll&&B===false){this.headerCheckbox.addClass("x-grid3-hd-checker-on")}},this);Ext.grid.CheckboxSelectionModel.prototype.initEvents.call(this)},onMouseDown:function(B,A){if(B.button===0&&A.className=="x-grid3-row-checker"){B.stopEvent();var C=B.getTarget(".x-grid3-row");if(C){if(this.headerCheckbox){this.markAll=false;this.headerCheckbox.removeClass("x-grid3-hd-checker-on")}}}return Ext.grid.CheckboxSelectionModel.prototype.onMouseDown.call(this,B,A)},onHdMouseDown:function(B,A){if(A.className=="x-grid3-hd-checker"&&!this.headerCheckbox){this.headerCheckbox=new Ext.Element(A.parentNode)}return Ext.grid.CheckboxSelectionModel.prototype.onHdMouseDown.call(this,B,A)},renderer:function(B,C,A){return Ext.grid.CheckboxSelectionModel.prototype.renderer.call(this,B,C,A)},handleMouseDown:function(A,C,B){if(B.shiftKey){return }this.markAll=false;if(this.headerCheckbox){this.headerCheckbox.removeClass("x-grid3-hd-checker-on")}Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.handleMouseDown.call(this,A,C,B)},clearSelections:function(A){if(this.isLocked()){return }this.markAll=false;if(this.headerCheckbox){this.headerCheckbox.removeClass("x-grid3-hd-checker-on")}Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.clearSelections.call(this,A)},selectAll:function(){Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.selectAll.call(this);this.markAll=true;if(this.headerCheckbox){this.headerCheckbox.addClass("x-grid3-hd-checker-on")}}});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

    r73 r79  
    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><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">&#160;</div>','<div class="x-grid3-resize-proxy">&#160;</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,liveScrollerInsets: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})}},render:function(){if(this.autoFill){var A=this.grid.ownerCt;if(A&&A.getLayout()){A.on("afterlayout",function(){this.fitColumns(true,true);this.updateHeaders();this.updateHeaderSortState()},this,{single:true})}}else{if(this.forceFit){this.fitColumns(true,false)}else{if(this.grid.autoExpandColumn){this.autoExpand(true)}}}this.grid.getGridEl().dom.innerHTML=this.renderUI();this.afterRenderUI()},renderUI:function(){var B=this.grid;var C=B.enableDragDrop||B.enableDrag;B.enableDragDrop=false;B.enableDrag=false;var A=this._gridViewSuperclass.renderUI.call(this);var B=this.grid;B.enableDragDrop=C;B.enableDrag=C;if(C){this.dragZone=new Ext.ux.grid.livegrid.DragZone(B,{ddGroup:B.ddGroup||"GridDD"})}return A},afterRenderUI:function(){this._gridViewSuperclass.afterRenderUI.call(this);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 B=this._loadMaskAnchor.dom;var A=Ext.Element.data;A(B,"mask").addClass("ext-ux-livegrid");A(B,"mask").setDisplayed(false);A(B,"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 F=Ext.Element;var B=this.grid.getGridEl().dom.firstChild;var A=B.childNodes;this.el=new F(B);this.mainWrap=new F(A[1]);this.liveScroller=new F(A[0]);var D=this.liveScroller.dom.firstChild;this.liveScrollerInsets=[D,D.nextSibling,D.nextSibling.nextSibling];this.liveScroller.on("scroll",this.onLiveScroll,this,{buffer:this.scrollDelay});var C=this.mainWrap.dom.firstChild;this.mainHd=new F(C);this.hdHeight=C.offsetHeight;this.innerHd=this.mainHd.dom.firstChild;this.scroller=new F(this.mainWrap.dom.childNodes[1]);if(this.forceFit){this.scroller.setStyle("overflow-x","hidden")}this.mainBody=new F(this.scroller.dom.firstChild);this.mainBody.on("mousewheel",this.handleWheel,this);this.focusEl=new F(this.scroller.dom.childNodes[1]);this.focusEl.swallowEvent("click",true);this.resizeMarker=new F(A[2]);this.resizeProxy=new F(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=="&nbsp;"){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 H=this.liveScroller.dom;var E=this.grid,B=E.store;var G=E.getGridEl();var K=G.getSize().width;var A=(B.totalLength==this.visibleRows-this.rowClipped)?0:Math.max(0,B.totalLength-(this.visibleRows-this.rowClipped));if(A==0){this.scroller.setWidth(K);H.style.display="none";return }else{this.scroller.setWidth(K-this.getScrollOffset());H.style.display=""}var L=this.cm.getTotalWidth()+this.getScrollOffset()>K;var J=H.parentNode.offsetHeight+((B.totalLength>0&&L)?-this.horizontalScrollOffset:0)-this.hdHeight;H.style.height=Math.max(J,this.horizontalScrollOffset*2)+"px";if(this.rowHeight==-1){return }var D=(A==0?0:J+(A*this.rowHeight));var I=D;var F=this.liveScrollerInsets.length;if(D==0){D=0}else{D=Math.round(D/F)}for(var C=0;C<F;C++){if(C==F-1&&D!=0){D-=(D*3)-I}this.liveScrollerInsets[C].style.height=D+"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.doRequest(Ext.data.Api.actions.read,null,C,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(){}}); 
     1Ext.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({reset:true,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><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">&#160;</div>','<div class="x-grid3-resize-proxy">&#160;</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,liveScrollerInsets: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.suspendEvents();this.refresh(true);this.resumeEvents();this.processRows=B;this.processRows(0);this.fireEvent("cursormove",this,0,Math.min(this.ds.totalLength,this.visibleRows-this.rowClipped),this.ds.totalLength);this.fireEvent("reset",this,D);return false}else{var C={};var A=this.ds.sortInfo;if(A){C={dir:A.direction,sort:A.field}}this.fireEvent("reset",this,D);return this.ds.load({params:C})}},renderUI:function(){var B=this.grid;var C=B.enableDragDrop||B.enableDrag;B.enableDragDrop=false;B.enableDrag=false;var A=this._gridViewSuperclass.renderUI.call(this);var B=this.grid;B.enableDragDrop=C;B.enableDrag=C;if(C){this.dragZone=new Ext.ux.grid.livegrid.DragZone(B,{ddGroup:B.ddGroup||"GridDD"})}return A},afterRenderUI:function(){this._gridViewSuperclass.afterRenderUI.call(this);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 B=this._loadMaskAnchor.dom;var A=Ext.Element.data;A(B,"mask").addClass("ext-ux-livegrid");A(B,"mask").setDisplayed(false);A(B,"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 F=Ext.Element;var B=this.grid.getGridEl().dom.firstChild;var A=B.childNodes;this.el=new F(B);this.mainWrap=new F(A[1]);this.liveScroller=new F(A[0]);var D=this.liveScroller.dom.firstChild;this.liveScrollerInsets=[D,D.nextSibling,D.nextSibling.nextSibling];this.liveScroller.on("scroll",this.onLiveScroll,this,{buffer:this.scrollDelay});var C=this.mainWrap.dom.firstChild;this.mainHd=new F(C);this.hdHeight=C.offsetHeight;this.innerHd=this.mainHd.dom.firstChild;this.scroller=new F(this.mainWrap.dom.childNodes[1]);if(this.forceFit){this.scroller.setStyle("overflow-x","hidden")}this.mainBody=new F(this.scroller.dom.firstChild);this.mainBody.on("mousewheel",this.handleWheel,this);this.focusEl=new F(this.scroller.dom.childNodes[1]);this.focusEl.swallowEvent("click",true);this.resizeMarker=new F(A[2]);this.resizeProxy=new F(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=="&nbsp;"){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(H,E,B){if(!this.ds||this.ds.getCount()<1){return }E=E||!this.grid.stripeRows;var I=this.rowIndex;var K=this.getRows();var D=0;var A=this.grid.selModel;var G=A.isAllSelected();var J=null;for(var F=0,C=K.length;F<C;F++){J=K[F];J.rowIndex=D=I+F;J.className=J.className.replace(this.rowClsRe," ");if(!E&&(D+1)%2===0){J.className+=" x-grid3-row-alt"}if(B!==false){if(A.isSelected(this.ds.getAt(D))===true){this.addRowClass(D,this.selectedRowClass)}else{this.removeRowClass(D,this.selectedRowClass)}this.fly(J).removeClass("x-grid3-row-over")}}if(I===0){Ext.fly(K[0]).addClass(this.firstRowCls)}else{if(I+K.length==this.ds.totalLength){Ext.fly(K[K.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 H=this.liveScroller.dom;var E=this.grid,B=E.store;var G=E.getGridEl();var K=G.getSize().width;var A=(B.totalLength==this.visibleRows-this.rowClipped)?0:Math.max(0,B.totalLength-(this.visibleRows-this.rowClipped));if(A==0){this.scroller.setWidth(K);H.style.display="none";return }else{this.scroller.setWidth(K-this.getScrollOffset());H.style.display=""}var L=this.cm.getTotalWidth()+this.getScrollOffset()>K;var J=H.parentNode.offsetHeight+((B.totalLength>0&&L)?-this.horizontalScrollOffset:0)-this.hdHeight;H.style.height=Math.max(J,this.horizontalScrollOffset*2)+"px";if(this.rowHeight==-1){return }var D=(A==0?0:J+(A*this.rowHeight));var I=D;var F=this.liveScrollerInsets.length;if(D==0){D=0}else{D=Math.round(D/F)}for(var C=0;C<F;C++){if(C==F-1&&D!=0){D-=(D*3)-I}this.liveScrollerInsets[C].style.height=D+"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.allSelected=false;this.excludes=[];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;if(this.allSelected&&!this.excludes[C.id]){return true}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 }if(this.allSelected){this.excludes[A.id]=true}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){if(this.allSelected){this.excludes[C.id]=true}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];delete this.excludes[C.id]}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;this.allSelected=false;this.excludes=[]},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)}}},isAllSelected:function(){return this.allSelected},selectAll:function(){if(this.isLocked()){return }this.excludes=[];this.selectRange(0,this.grid.store.getTotalCount(),false);this.allSelected=true},getExcludes:function(){return this.excludes}});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.doRequest(Ext.data.Api.actions.read,null,C,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.CheckboxSelectionModel=Ext.extend(Ext.ux.grid.livegrid.RowSelectionModel,{width:20,menuDisabled:true,sortable:false,fixed:true,dataIndex:"",id:"checker",headerCheckbox:null,markAll:false,constructor:function(){if(!this.header){this.header=Ext.grid.CheckboxSelectionModel.prototype.header}this.sortable=false;Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.constructor.call(this)},initEvents:function(){Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.initEvents.call(this);this.grid.view.on("reset",function(A,B){this.headerCheckbox=new Ext.Element(A.getHeaderCell(this.grid.getColumnModel().getIndexById(this.id)).firstChild);if(this.markAll&&B===false){this.headerCheckbox.addClass("x-grid3-hd-checker-on")}},this);Ext.grid.CheckboxSelectionModel.prototype.initEvents.call(this)},onMouseDown:function(B,A){if(B.button===0&&A.className=="x-grid3-row-checker"){B.stopEvent();var C=B.getTarget(".x-grid3-row");if(C){if(this.headerCheckbox){this.markAll=false;this.headerCheckbox.removeClass("x-grid3-hd-checker-on")}}}return Ext.grid.CheckboxSelectionModel.prototype.onMouseDown.call(this,B,A)},onHdMouseDown:function(B,A){if(A.className=="x-grid3-hd-checker"&&!this.headerCheckbox){this.headerCheckbox=new Ext.Element(A.parentNode)}return Ext.grid.CheckboxSelectionModel.prototype.onHdMouseDown.call(this,B,A)},renderer:function(B,C,A){return Ext.grid.CheckboxSelectionModel.prototype.renderer.call(this,B,C,A)},handleMouseDown:function(A,C,B){if(B.shiftKey){return }this.markAll=false;if(this.headerCheckbox){this.headerCheckbox.removeClass("x-grid3-hd-checker-on")}Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.handleMouseDown.call(this,A,C,B)},clearSelections:function(A){if(this.isLocked()){return }this.markAll=false;if(this.headerCheckbox){this.headerCheckbox.removeClass("x-grid3-hd-checker-on")}Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.clearSelections.call(this,A)},selectAll:function(){Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.selectAll.call(this);this.markAll=true;if(this.headerCheckbox){this.headerCheckbox.addClass("x-grid3-hd-checker-on")}}}); 
  • trunk/CHANGELOG

    r73 r79  
    1 06-February-2011 
     1Version 0.5RC1 (GPL) 
     209-February-2011 
     3 - fixed: (GridView.js) fixed an issue where selections not currently in the 
     4buffer would get accidently removed once the grid gets reset 
     5 - enhancement: added CheckboxSelectionModel.js to be able to use a 
     6checkboxselection with Ext.ux.Livegrid 
     7 
     806-February-2011 
    29 - enhancement: (GridView.js) added compatibility for use with Ext 3.3 
    310 
  • trunk/examples

    • Property svn:ignore set to
      editor_grid
      large_columns
  • trunk/src/GridView.js

    r73 r79  
    3737 
    3838    this.addEvents({ 
     39        /** 
     40         * @event reset 
     41         * Fires when the grid resets. 
     42         * @param {Ext.ux.grid.livegrid.GridView} this 
     43         * @param {Boolean} forceReload 
     44         */ 
     45        'reset' : true, 
    3946        /** 
    4047         * @event beforebuffer 
     
    312319            var _ofn = this.processRows; 
    313320            this.processRows = Ext.emptyFn; 
     321            this.suspendEvents(); 
    314322            this.refresh(true); 
     323            this.resumeEvents(); 
    315324            this.processRows = _ofn; 
    316325            this.processRows(0); 
     
    319328                           Math.min(this.ds.totalLength, this.visibleRows-this.rowClipped), 
    320329                           this.ds.totalLength); 
     330            this.fireEvent('reset', this, forceReload); 
    321331            return false; 
    322332        } else { 
     
    332342            } 
    333343 
     344            this.fireEvent('reset', this, forceReload); 
    334345            return this.ds.load({params : params}); 
    335346        } 
     
    11161127        skipStripe = skipStripe || !this.grid.stripeRows; 
    11171128 
    1118         var cursor     = this.rowIndex; 
    1119         var rows       = this.getRows(); 
    1120         var index      = 0; 
     1129        var cursor      = this.rowIndex; 
     1130        var rows        = this.getRows(); 
     1131        var index       = 0; 
     1132        var sm          = this.grid.selModel; 
     1133        var allSelected = sm.isAllSelected(); 
    11211134 
    11221135        var row = null; 
     
    11311144 
    11321145            if (paintSelections !== false) { 
    1133                 if (this.grid.selModel.isSelected(this.ds.getAt(index)) === true) { 
     1146                if (sm.isSelected(this.ds.getAt(index)) === true) { 
    11341147                    this.addRowClass(index, this.selectedRowClass); 
    11351148                } else { 
  • trunk/src/RowSelectionModel.js

    r36 r79  
    4949    Ext.apply(this, config); 
    5050 
     51    this.allSelected = false; 
     52    this.excludes    = []; 
     53 
    5154    this.pendingSelections = {}; 
    5255 
     
    299302 
    300303        var r = index; 
     304 
     305        if (this.allSelected && !this.excludes[r.id]) { 
     306            return true; 
     307        } 
     308 
    301309        return (r && this.selections.key(r.id) ? true : false); 
    302310    }, 
     
    318326        if (!isSelected) { 
    319327            return; 
     328        } 
     329 
     330        if (this.allSelected) { 
     331            this.excludes[record.id] = true; 
    320332        } 
    321333 
     
    371383 
    372384        if (r) { 
     385            if (this.allSelected) { 
     386                this.excludes[r.id] = true; 
     387            } 
    373388            this.selections.remove(r); 
    374389        } 
     
    406421                this.selections.add(r); 
    407422                delete this.pendingSelections[index]; 
     423                delete this.excludes[r.id]; 
    408424            } else { 
    409425                this.pendingSelections[index] = true; 
     
    558574        } 
    559575        this.last = false; 
     576        this.allSelected = false; 
     577        this.excludes = []; 
    560578    }, 
    561579 
     
    589607        } 
    590608 
     609    }, 
     610 
     611    /** 
     612     * Returns true if all rows available are selected. 
     613     */ 
     614    isAllSelected : function() 
     615    { 
     616        return this.allSelected; 
     617    }, 
     618 
     619    /** 
     620     * Selects all rows if the selection model 
     621     * {@link Ext.grid.AbstractSelectionModel#isLocked is not locked}. 
     622     */ 
     623    selectAll : function() 
     624    { 
     625        if(this.isLocked()){ 
     626            return; 
     627        } 
     628 
     629        this.excludes = []; 
     630        this.selectRange(0, this.grid.store.getTotalCount(), false); 
     631        this.allSelected = true; 
     632    }, 
     633 
     634    /** 
     635     * Returns an object with all records currently being excluded, 
     636     * whereas the key is the id of the record, and it's value is 
     637     * set to boolean true. 
     638     */ 
     639    getExcludes : function() 
     640    { 
     641        return this.excludes; 
    591642    } 
    592643 
     644 
     645 
    593646}); 
    594647