Hybrid View

  1. #1
    Ext User
    Join Date
    May 2007
    Posts
    57
    Vote Rating
    0
    splintor is on a distinguished road

      0  

    Default [2.2] Problems disabling grid columns menus

    [2.2] Problems disabling grid columns menus


    Hi,
    I just upgraded to ExtJS 2.2 (from version 2.0) and have problems with the grid. Hovering over a column changes its title and show a menu. I don

  2. #2
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    why is this a bug?

    the menus are disabled, aren't they?

    the mouseover effect on the grid headers is merely a visual effect.
    unless you've also disabled sorting on all your columns, i'd think you'd still want to indicate to users that they're hovering over an item which can be clicked, no?

  3. #3
    Ext User
    Join Date
    May 2007
    Posts
    57
    Vote Rating
    0
    splintor is on a distinguished road

      0  

    Default


    I have disabled sorting on all my columns, and I don't want this visual effect. How do I get rid of it?

    The current code doesn't show this visual effect for a column if the column has its menuDisabled property set to false (even if it is sortable), so it is related to menu displaying. What I

  4. #4
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    iirc setting defaultSortable:false on the grid's ColumnModel should do the trick.
    my code's in the office so try that first and let me know if it works.

    p.s. disabling the menu is a separate issue from disabling the column sorter, which is the header mouseover effect you're seeing -- neither should affect the other.

    [edit]
    found it. stick this viewConfig into your gridpanel:
    Code:
    // ...
    
        viewConfig: {
            headersDisabled: true // disable grid headers
        }
    
    // ...
    note that this also disables column drag and drop.

    still not a bug though -- although this particular GridView config is for a fact undocumented.
    i'll make a mention of this in the doc bugs thread.
    Last edited by mystix; 9 Sep 2008 at 5:59 PM. Reason: edit

  5. #5
    Ext User
    Join Date
    May 2007
    Posts
    57
    Vote Rating
    0
    splintor is on a distinguished road

      0  

    Default


    But I do want column drag and drop, so I don

  6. #6
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    you might be right.

    based on our discussion thus far, plus the new info from your last post, the handlerHdOver() method should probably be this instead:
    Code:
    // specific to @splintor's case -- as @condor advised, it's still 
    // advisable to use the GridView's headersDisabled config
    Ext.override(Ext.grid.GridView, {
        handleHdOver : function(e, t){
            var hd = this.findHeaderCell(t);
            if(hd && !this.headersDisabled){
                this.activeHd = hd;
                this.activeHdIndex = this.getCellIndex(hd);
                var fly = this.fly(hd);
                this.activeHdRegion = fly.getRegion();
    
                // ensure the header menu is not disabled, and that the column is sortable
                if(!this.cm.isMenuDisabled(this.activeHdIndex) || this.cm.isSortable(this.activeHdIndex)){
                    fly.addClass("x-grid3-hd-over");
                    this.activeHdBtn = fly.child('.x-grid3-hd-btn');
                    if(this.activeHdBtn){
                        this.activeHdBtn.dom.style.height = (hd.firstChild.offsetHeight-1)+'px';
                    }
                }
            }
        }
    });
    [edit]
    and the isMenuDisabled() method also needs to be:
    Code:
    // minor bugfix for existing ColumnModel.isMenuDisabled() method
    Ext.override(Ext.grid.GridPanel, {
        initComponent: Ext.grid.GridPanel.prototype.initComponent.createSequence(function() {
            if (this.colModel) {
                // give the ColumnModel a reference to this grid
                this.colModel.grid = this;
            }
        })
    });
    
    Ext.override(Ext.grid.ColumnModel, {
        isMenuDisabled : function(col){
            return !this.grid.enableHdMenu || !!this.config[col].menuDisabled;
        }
    });
    Last edited by mystix; 9 Sep 2008 at 11:19 PM. Reason: final edit. tested with array-grid.js

  7. #7
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    94
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    I don't think that is a good solution.

    Remember that column menus are also used for hiding and grouping (and plugins like filtering).

    Your original suggestion was better. Set headersDisabled:false if you want to disable the menus for all columns or set menuDisabled:false for separate columns.

    I see you changed your post again: I agree with the second change (but not the first one).

  8. #8
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    how about the latest code? was busy checking/editing while your were reading my last post

  9. #9
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    alritey.. final edit.
    found a bug in the 2nd chunk of code.

    tested with the array-grid.js example.

    [edit]
    added notes to the first chunk of code in post #6 as per @condor's advice, which i also subscribe to.

  10. #10
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    6
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    Quote Originally Posted by Condor View Post
    Set headersDisabled:false if you want to disable the menus for all columns or set menuDisabled:false for separate columns.
    Is it me, or is the opposite actually true?