1. #821
    Sencha User
    Join Date
    Mar 2008
    Posts
    58
    Vote Rating
    0
    Ballsacian1 is on a distinguished road

      0  

    Default Ext.grid.livegrid.CheckboxSelectionModel mouse and keyboard events called twice

    Ext.grid.livegrid.CheckboxSelectionModel mouse and keyboard events called twice


    Ext.grid.livegrid.CheckboxSelectionModel mouse and keyboard events called twice

    How to Reproduce:
    Load the Checkbox demo in the livegrid source and either click on a row or try moving up and down rows with the arrow keys. Moving up and down results in skipping a record each time and clicking with the mouse only allows certain actions to take place because mousedown and keyup are being called twice each time.

    Problem:
    Red text represents the problem and green text represents the added code to solve it.

    Line 68 of Ext.grid.livegrid.CheckboxSelectionModel.js
    Code:
    initEvents : function()
        {   
            this.skipParentInitEvents = true;
            Ext.ux.grid.livegrid.CheckboxSelectionModel.superclass.initEvents.call(this);
    
    
            this.grid.view.on('reset', function(gridView, forceReload) {
                    this.headerCheckbox = new Ext.Element(
                        gridView.getHeaderCell(this.grid.getColumnModel().getIndexById(this.id)).firstChild
                    );
                    if (this.markAll && forceReload === false) {
                        this.headerCheckbox.addClass('x-grid3-hd-checker-on');
                    }
            }, this);
    
    
            Ext.grid.CheckboxSelectionModel.prototype.initEvents.call(this);
        },
    and line 64 of Ext.grid.livegrid.RowSelectionModel.js
    Code:
    initEvents : function()
        {
            if(!this.skipParentInitEvents){
                Ext.ux.grid.livegrid.RowSelectionModel.superclass.initEvents.call(this);
            }
    
    
            var grid  = this.grid,
                view  = grid.view,
                store = grid.store;
    
    
            view.on('rowsinserted',    this.onAdd,            this);
            store.on('selectionsload', this.onSelectionsLoad, this);
            store.on('load',           this.onStoreLoad,      this);
        },
    Because of these three superclass calls the Ext.ux.grid.livegrid.RowSelectionModel.superclass gets called twice resulting in Ext.grid.RowSelectionModel.initEvents being called twice and the mousedown and keyup events being doubled.

    Solution:
    By adding a flag for skipping the superclass initEvents, the CheckboxSelectionModel can still call both superclasses without worry of the double event hooks.

  2. #822
    Ext JS Premium Member
    Join Date
    May 2008
    Posts
    336
    Vote Rating
    1
    ttbgwt is on a distinguished road

      0  

    Default


    Can you add a column locking feature to your live grid, or at least point me in the right direction to get something working? I purchased a developers license a few months ago.

    Thanks!

  3. #823
    Sencha User
    Join Date
    Jun 2010
    Posts
    14
    Vote Rating
    0
    psm1963 is on a distinguished road

      0  

    Default


    I've upgraded to 3.4 and have seen some strange behavior of live grid but only on IE....sometimes only ten rows populate in a grid and there is empty space where it should have added more visible row...any ideas...works fine in FF and Chrome

  4. #824
    Sencha User
    Join Date
    Oct 2007
    Location
    Berlin, Germany
    Posts
    854
    Vote Rating
    2
    wm003 is on a distinguished road

      0  

    Default


    Quote Originally Posted by psm1963 View Post
    I've upgraded to 3.4 and have seen some strange behavior of live grid but only on IE....sometimes only ten rows populate in a grid and there is empty space where it should have added more visible row...any ideas...works fine in FF and Chrome
    i had something similar and fixed it as follows:
    Code:
        liveBufferUpdateFirstTime:true,
        // private
        liveBufferUpdate : function(records, options, success)
        {
            if (success === true) {
                this.adjustBufferInset();
    
                this.fireEvent('buffer', this, this.ds, this.rowIndex,
                    Math.min(this.ds.totalLength, this.visibleRows-this.rowClipped),
                    this.ds.totalLength,
                    options
                );
    
                // this is needed since references to records which have been unloaded
                // get lost when the store gets loaded with new data.
                // from the store
                this.grid.selModel.replaceSelections(records);
    
                this.isBuffering    = false;
                this.isPrebuffering = false;
                this.showLoadMask(false);
    
                if (this.requestQueue >= 0) {
                    var offset = this.requestQueue;
                    this.requestQueue = -1;
                    this.updateLiveRows(offset);
                    return;
                }
    
                if (this.isInRange(this.rowIndex)) {
                    this.replaceLiveRows(this.rowIndex, options.forceRepaint);
                } else {
                    this.updateLiveRows(this.rowIndex);
                }
                if (this.liveBufferUpdateFirstTime) {
                    this.liveBufferUpdateFirstTime=false;                
                    this.layout();
                }
                return;
            } else {
                this.fireEvent('bufferfailure', this, this.ds, options);
            }
    
            this.requestQueue   = -1;
            this.isBuffering    = false;
            this.isPrebuffering = false;
            this.showLoadMask(false);