1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    5
    Answers
    3
    Vote Rating
    1
    mattea is on a distinguished road

      0  

    Default Unanswered: First Group Element as Header

    Unanswered: First Group Element as Header


    I am trying to modify the grouping to display the first child as the group header rather than the group name, and then not have that child in the list of elements. Think the way email threads are usually displayed (see attached for simple image of it).

    I have searched extensively and been unable to find any instances of this. I have coded a "working" solution, but it is extremely hackish and it seems to screw up the number of the rows (the ids of the rows do not necessarily correlate to the row text). My method was to break up the values object into its first item and rest of the items, then recurse separately on them in two portions of the template. But recurse obviously does some more complicated things, such that it breaks the system.

    Has anyone done this?

    Thanks. I will post my (broken) code below:

    Code:
    Ext.define('MyApp.ThreadGrouping', {
      extend: 'Ext.grid.feature.Grouping',
      alias: 'feature.threadgrouping',
      eventSelector: '.' + Ext.baseCSSPrefix + 'grid-threadgroup-hd',
      hdCollapsedCls: Ext.baseCSSPrefix + 'grid-threadgroup-hd-collapsed',
    
    
      getFeatureTpl: function( values, parent, x, xcount) {
        var me = this;
    
    
        return [
          '<tpl if="typeof rows !== \'undefined\'">',
            '<tr class="' + Ext.baseCSSPrefix + 'grid-threadgroup-hd ' + (me.startCollapsed ? me.hdCollapsedCls : '') + ' {[this.singleCls(values)]} {addlSelector} {rowCls}" {rowAttr}><td colspan="' + parent.columns.length + '">{[this.recurse(this.firstr(values))]}</td>',
            '</tr>',
            
            '<tr id="{viewId}-gp-{name}" class="' + Ext.baseCSSPrefix + 'grid-group-body '  + (me.startCollapsed ? me.collapsedCls : '') + ' {collapsedCls}"><td colspan="' + parent.columns.length + '">',
            '<tpl if="this.hasMult(values)">',
              '{[this.recurse(this.restr(values))]}',
            '</tpl>',
            '</td></tr>',
    
    
          '</tpl>'].join('');
      },
      getFragmentTpl: function() {
        return Ext.apply(this.callParent(), {
          firstr: Ext.bind(this.firstr,this),
          restr: Ext.bind(this.restr,this),
          columns: this.view.panel.columns,
          hasMult: this.hasMult,
          singleCls: this.singleCls
        });
      },
      firstr: function(vals) {
        var newvals = {};
        Ext.apply(newvals,vals);
        if (newvals.rows.length > 0) {
          newvals.rows = [vals.rows[0]];
        } 
        return newvals;
      },
      restr: function(vals) {
        var newvals = {};
        Ext.apply(newvals,vals);
        newvals.rows = vals.rows.slice(1);
        return newvals;
      },
      hasMult: function(vals) {
        return vals.rows.length > 1;
      },
      singleCls: function(vals) {
        return (vals.rows.length == 1 ? 'singleThread' : '');
      },
    });
    Attached Images

  2. #2
    Sencha User
    Join Date
    Jul 2012
    Posts
    25
    Answers
    2
    Vote Rating
    1
    jugg1es can only hope to improve

      0  

    Default


    I have been working on the exact same thing for days. Have you found a solution?

  3. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    5
    Answers
    3
    Vote Rating
    1
    mattea is on a distinguished road

      0  

    Default


    Quote Originally Posted by jugg1es View Post
    I have been working on the exact same thing for days. Have you found a solution?
    I have hacked together a working solution. I am attaching a minimal solution, although for some reason the columns are being oddly centered (which isn't happening on my production version). I am fairly positive this will NOT work across version upgrades (running under 4.1), but feel free to use it as you will.
    Attached Files
    Last edited by mattea; 10 Aug 2012 at 2:26 PM. Reason: typo

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi