Results 1 to 3 of 3

Thread: Hiding of all hideable columns not allowed?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    2
    Answers
    1
    Vote Rating
    0
      0  

    Default Answered: Hiding of all hideable columns not allowed?

    I noticed that a user cannot hide all columns in a gridpanel. It seems that the grid must at least display one column. I can imagine this is a nice feature, but it doesn't work quite as I expected when dealing with both hideable and non-hideable columns. It seems that the rule is that at least one hideable column is required to display, even if there is a non-hideable column in the grid.

    It doesn't make sense to me to not allow hiding of all hideable columns when at least one non-hideable column is displayed. Is this behaviour configurable?

    I created a demo based on the Stateful Array Grid Example showing the problem:
    http://jsfiddle.net/p9zqK/

  2. A simple hack is to allow all columns to be hidden unconditionally (in my application I don't bother about checking whether hideable columns exist, because I know they do...)


    Code:
    Ext.override(Ext.grid.header.Container,
    {
        updateMenuDisabledState: function()
        {
            var me = this,
            result = me.getLeafMenuItems(),
            total = result.checkedCount,
            items = result.items,
            len = items.length,
            i = 0,
            rootItem = me.getMenu().child('#columnItem');
    
    
            //if (total <= 1)
            if (total <= 0) /* Allow all columns to be hidden unconditionally */
            {
                me.disableMenuItems(rootItem, Ext.ComponentQuery.query('[checked=true]', items)[0]);
            }
            else
            {
                for (; i < len; ++i)
                {
                    me.setMenuItemState(total, rootItem, items[i]);
                }
            }
        }
    });

  3. #2
    Sencha User
    Join Date
    Nov 2012
    Posts
    2
    Answers
    1
    Vote Rating
    0
      0  

    Default Fixed

    A simple hack is to allow all columns to be hidden unconditionally (in my application I don't bother about checking whether hideable columns exist, because I know they do...)


    Code:
    Ext.override(Ext.grid.header.Container,
    {
        updateMenuDisabledState: function()
        {
            var me = this,
            result = me.getLeafMenuItems(),
            total = result.checkedCount,
            items = result.items,
            len = items.length,
            i = 0,
            rootItem = me.getMenu().child('#columnItem');
    
    
            //if (total <= 1)
            if (total <= 0) /* Allow all columns to be hidden unconditionally */
            {
                me.disableMenuItems(rootItem, Ext.ComponentQuery.query('[checked=true]', items)[0]);
            }
            else
            {
                for (; i < len; ++i)
                {
                    me.setMenuItemState(total, rootItem, items[i]);
                }
            }
        }
    });

  4. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Redwood City
    Posts
    30,644
    Answers
    15
    Vote Rating
    60
      0  

    Default

    This is fixed in 4.2

    Possibly the fix was in 4.1.3, but it definitely works with latest code.
    Longtime Sencha geek. Outspoken advocate of pure Javascript Views. Posts my own opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •