Results 1 to 7 of 7

Thread: Is it possible not to display the group header?

  1. #1
    Sencha User
    Join Date
    Jul 2009
    Posts
    48

    Default Is it possible not to display the group header?

    Is it possible not to display the group header? With group header I meant the row wherein the clickable + image appears along with configured header and rendered group field value.

    I need it NOT to display if in that group there is only one record. However if a group has more than one record then it displays the group header as it normally would.

    I've searched the forums and didn't find anything. I hope it is possible and if someone can show me how I can accomplish this, that would be great!

    Thanks,

  2. #2
    Ext User Lukman's Avatar
    Join Date
    Jun 2009
    Location
    Malaysia
    Posts
    138

    Default

    Group? What group? Button group? Checkbox group? Radio button group? Tab group? Be a little more specific, will ya? A sample code will help a lot in getting a good response from people.

  3. #3
    Sencha User
    Join Date
    Jul 2009
    Posts
    48

    Default

    Quote Originally Posted by Lukman View Post
    Group? What group? Button group? Checkbox group? Radio button group? Tab group? Be a little more specific, will ya? A sample code will help a lot in getting a good response from people.
    Sorry for not being more specific. I meant Record group within a GridPanel that uses the GroupingView.

    Anyway, I not sure if this is the proper way but I managed to accomplish this by modifying the following line of code in ext-all-debug.js:

    Code:
     
    '<div id="{groupId}-hd" class="x-grid-group-hd" style="{style}"><div class="x-grid-group-title">', this.groupTextTpl ,'</div></div>',
    to the following:

    Code:
     
    '<div id="{groupId}-hd" class="x-grid-group-hd" style="{[values.rs.length > 1 ? "" : "display:none;"]}"><div class="x-grid-group-title">', this.groupTextTpl ,'</div></div>',
    and that did the trick. If anybody has suggestions on how to properly implement this, maybe through an extension or a plugin, i'm sure that will help other people looking for this group header customization.

    Thanks!

  4. #4
    Sencha User makana's Avatar
    Join Date
    Apr 2008
    Location
    Dresden, Germany
    Posts
    527

    Default

    That's a good solution, but I would never edit the ext-all-debug.js or ext-all.js.
    Either you override the initTemplates-method of Ext.grid.GroupingView or you specify a startGroup-template as config-option "startGroup" to the Ext.grid.GroupingView. Look at the source for more information.
    Programming today is a race between software engineers striving to build bigger and better ?diot-proof programs, and the universe striving to produce bigger and better idiots. So far, the universe is winning. (Rick Cook)

    Enhanced ExtJS adapter for Adobe AIR

  5. #5
    Ext User Lukman's Avatar
    Join Date
    Jun 2009
    Location
    Malaysia
    Posts
    138

    Default

    Here is your plugin. Plug it into the GridPanel that uses that GroupingView:
    Code:
    {
        init: function(grid) {
            var gview = grid.getView();
            gview.startGroup = new Ext.XTemplate(
                '<div id="{groupId}" class="x-grid-group {cls}">',
                '<div id="{groupId}-hd" class="x-grid-group-hd" style="{[values.rs.length > 1 ? "" : "display:none;"]}"><div class="x-grid-group-title">', gview.groupTextTpl, '</div></div>',
                '<div id="{groupId}-bd" class="x-grid-group-body">'
            )
        }
    }

  6. #6
    Sencha User
    Join Date
    Jul 2009
    Posts
    48

    Default

    Thanks to you both for your suggestions. I have already placed this code to my very first plugin - GroupHeaderVisibility.

  7. #7
    Ext User Lukman's Avatar
    Join Date
    Jun 2009
    Location
    Malaysia
    Posts
    138

    Default

    I demand some credit! Just kidding :-P

    I dug through the source file to get the 'startGroup' part since it is undocumented.

Posting Permissions

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