Results 1 to 2 of 2

Thread: how to keep one column in grid panel when using nested header

  1. #1
    Sencha User SurenderBhyan1's Avatar
    Join Date
    Nov 2013
    Location
    INDIA
    Posts
    130
    Vote Rating
    11
      0  

    Default how to keep one column in grid panel when using nested header

    Hi,

    I have a grid panel with nested headers and each parent header contains multiple sub columns in it.
    From the header context menu, i can hide all the sub columns for a group, and subsequently that parent header also got hide.

    My requirement is to keep at least one sub column in each header.

    Do i need to add some config for it or any workaround can be used.

    This issue can be reproduced at below example, where we can hide all sub column of "Absences" parent column.


    http://docs.sencha.com/extjs/4.2.1/extjs-build/examples/build/KitchenSink/ext-theme-gray/#big-data-grid






    ---A ship in the harbor is safe, but that is not what the ships are made for...

  2. #2
    Sencha User SurenderBhyan1's Avatar
    Join Date
    Nov 2013
    Location
    INDIA
    Posts
    130
    Vote Rating
    11
      0  

    Default WORKAROUND

    Fixed this by below menu override in green. Still I am not sure if we can achieve this using other available configuration.

    Code:
    Ext.define('Override.menu.Menu', {            override: 'Ext.menu.Menu',
                compatibility: '4',
                onClick: function(e) {
                    var me = this,
                        item;
    
                    var visibleColumn = 0;
                    for (i=0; i < this.items.items.length; i++){
                        if(this.items.items[i].checked){
                            visibleColumn ++
                        }
                    }
    
                    // Show an alert if trying to hide all column from a grouped header. At leaset one column should present in each group.
                    if (visibleColumn == 1 && this.activeItem && this.activeItem.checked){
                        Ext.MessageBox.show({
                            title: 'Warning',
                            msg: 'Select at least one column',
                            buttons: Ext.MessageBox.OK
                        });
                        return false;
                    }
    
                    if (me.disabled) {
                        e.stopEvent();
                        return;
                    }
    
    
                    item = (e.type === 'click') ? me.getItemFromEvent(e) : me.activeItem;
                    if (item && item.isMenuItem) {
                        if (!item.menu || !me.ignoreParentClicks) {
                            item.onClick(e);
                        } else {
                            e.stopEvent();
                        }
                    }
                    // Click event may be fired without an item, so we need a second check
                    if (!item || item.disabled) {
                        item = undefined;
                    }
                    me.fireEvent('click', me, item, e);
                }
            });
    ---A ship in the harbor is safe, but that is not what the ships are made for...

Similar Threads

  1. Grid panel column header colour
    By highradius in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 22 Jan 2016, 8:36 PM
  2. Grid Panel Column header menu
    By highradius in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 24 Mar 2014, 9:00 AM
  3. Having Header Column in Ext.grid.Panel
    By kisundar in forum Ext: Q&A
    Replies: 3
    Last Post: 29 Oct 2012, 12:15 PM

Tags for this Thread

Posting Permissions

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