tags:

views:

99

answers:

1

Hi everyone,

I'm trying to do use getRowClass in a grid panel with grouping view enabled.

Here is my code (short version)

var myPanel = new Ext.grid.GridPanel({
 contentEl: 'editor-grid',
 region: 'center',
 ds: ds,
 cm: cm,
 autoScroll: true,
 autoExpandColumn:'method-name',

 view: new Ext.grid.GroupingView({
  startCollapsed:false,
  groupTextTpl: '{[values.rs[0].data.class_name]}',
  scrollToTop: Ext.emptyFn
 }),

 loadMask : {msg: 'loading data...'},
 cType:'list',

 viewConfig: {
  forceFit: true,
  enableRowBody: true,
  showPreview: true,
  getRowClass: function(record, rowIndex, p, store) { 
   if(this.showPreview) {
    p.body = '<p class="method_info_data">' + 'insert data here...' + '</p>';
    return 'x-grid3-row-expanded';
   }
   return 'x-grid3-row-collapsed';
  }
 }

 ...
});

If I remove the complete view "block" from config - it works but without grouping the data in my grid.

Thankful for any help!

Flo

A: 

Got it!

You have to do the "magic" inside view config of the grid. Like this:

view: new Ext.grid.GroupingView({
        startCollapsed:false,
        groupTextTpl: '{[values.rs[0].data.class_name]}',
        scrollToTop: Ext.emptyFn,

        forceFit: true,
        enableRowBody: true,
        showPreview: true,
        getRowClass: function(record, rowIndex, p, store) { 
            if(this.showPreview) {
                p.body = '<p class="method_info_data">' + 'insert data here...' + '</p>';
                return 'x-grid3-row-expanded';
            }
            return 'x-grid3-row-collapsed';
        }
    }),
Flo