Results 1 to 4 of 4

Thread: [FIXED][3.0.0/2.x] Ext.grid.GroupingView ids contain full text instead of group value

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium Member
    Join Date
    Mar 2007
    Posts
    43

    Default [TENT][3.0.0/2.x] Ext.grid.GroupingView ids contain full text instead of group value

    Ext version tested:
    • Ext 3.0


    Adapter used: doesn't matter

    Browser versions tested against: doesn't matter (all)

    Operating System: doesn't matter (all)

    Description:
    When you using an Ext.grid.GroupingView for a grid, it will create wrapper divs around the rows. The element IDs of these rows contain the text description returned by the groupRenderer specified, not the group value. This makes it harder to use the group ID to actually find the row, and can result in bloated div ids.

    Furthermore, the "getGroupId" function returns an ID based on the group value, not the description returned by the groupRenderer. That means the getGroupId function is inconsistent with the other code and so the method is useless.

    Test Case:

    Edit examples/grid/grouping.js line 37 to add a groupRenderer to industry, like this:
    Code:
                {header: "Industry", width: 20, sortable: true, dataIndex: 'industry', groupRenderer: function(v) {return "my long description of the " + v + " industry"}},
    Then view the grouping.html example and inspect the group element. The ID of the first group is now:
    Code:
    <div id="ext-gen10-gp-industry-my long description of the Automotive industry-bd" class="x-grid-group-body">
    whereas getGroupId for that industry returns "ext-gen10-gp-industry-Automotive".

    Possible fix:

    Change line 394 in GroupingView.js from this:

    Code:
                    gid = gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(g);
    to this:

    Code:
                    gid = gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(gvalue);
    So that the value of the grouping field is used instead of the text returned by the groupRenderer. This would then be consistent with the getGroupId method.

    Note that a similar report is still open about this:
    http://extjs.com/forum/showthread.php?t=37065

    That suggests changing it the other way around. I suppose that would make it consistent, as long as the doRender code and getGroupId use the same Ids (or for that matter have doRender call getGroupId). But it makes more sense to me at least to have the group value in the div's ID, not the return value from the groupRenderer. After all in theory two different IDs could return the same value from their respective groupRenderers, but the group values themselves must be unique since that is how the grouping is presumably done.

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,239

    Default

    There's problems with both approaches, as pointed out in the other thread. Seems the only way to get around it is to make it configurable.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,239

    Default

    Fixed in SVN, check out the new groupMode config on the view.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  4. #4
    Sencha User
    Join Date
    Jan 2008
    Location
    Toronto, Canada
    Posts
    481

    Default

    Good stuff. Thanks for fixing this.

Posting Permissions

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