1. #1
    Ext JS Premium Member
    Join Date
    Feb 2008
    Location
    SRC solution, Toulouse, FR
    Posts
    18
    Vote Rating
    2
    jfa is on a distinguished road

      0  

    Question Grid migration : groupRenderer gone ?

    Grid migration : groupRenderer gone ?


    Hi, i would like to customize groupHeaderTpl for each column (to group by month when type is date for example), but i do not find groupRenderer property (present in Ext3).
    Is there another solution ?
    Thx

  2. #2
    Ext JS Premium Member
    Join Date
    Feb 2008
    Location
    SRC solution, Toulouse, FR
    Posts
    18
    Vote Rating
    2
    jfa is on a distinguished road

      0  

    Default


    Ok, FYI, i found a solution directly in store (of course!) with method getGroupString

    Code:
    getGroupString: function(instance) {
       var group = this.groupers.first();
       if (group) {
          if (group.property == 'mydate') {
             return Ext.Date.format(instance.get(group.property), 'Y-m');
          }
          return instance.get(group.property);
       }
       return '';
    }

  3. #3
    Sencha User razvanioan's Avatar
    Join Date
    Feb 2008
    Location
    Romania
    Posts
    113
    Vote Rating
    2
    razvanioan is on a distinguished road

      0  

    Default


    Thanks jfa,

    I've used your solution as well, as nobody else could help me here.

    Bye,

  4. #4
    Sencha Premium Member
    Join Date
    Aug 2007
    Location
    Pilsen, Czech Republic
    Posts
    40
    Vote Rating
    0
    dherbolt is an unknown quantity at this point

      0  

    Default


    Hi,
    you can use Ext.grid.column.Column.renderer instead of groupRenderer. It has same behavior as groupRenderer in ExtJS 3.

  5. #5
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      1  

    Lightbulb


    Here's a cleaner workaround:

    Code:
    Ext.define('xui.mods.Grouper', {    
        override: 'Ext.util.Grouper',
        getGroupString: function(rec){
            var field = rec.fields.map[this.property];
            if(field.groupTpl){
                if(!field.groupTpl.isTemplate){
                    field.groupTpl = new Ext.XTemplate(field.groupTpl);
                }
                return field.groupTpl.apply(rec.getData());
            }
            return rec.get(this.property);
        }
    });
    Then on your model field:

    Code:
    {
        name: 'OrderDate', 
        type: 'date', 
        groupTpl: '{OrderDate:date("F j, Y")}'
    }
    Jack Slocum
    Ext JS Founder
    Original author of Ext JS 1, 2 & 3.
    Twitter: @jackslocum
    jack@extjs.com

Similar Threads

  1. Replies: 1
    Last Post: 31 May 2010, 9:17 AM
  2. Replies: 4
    Last Post: 30 Jan 2009, 11:56 PM
  3. [2.1] Grouping View: groupRenderer
    By jaxl in forum Ext 2.x: Bugs
    Replies: 2
    Last Post: 16 Jan 2009, 12:43 PM
  4. cfg is null for grouprenderer
    By hxs_handle in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 27 Aug 2008, 5:33 PM

Thread Participants: 3

Tags for this Thread