ExtJS: getRowClass don't work in a GridPanel with grouping view enabled
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
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';
}
}),
精彩评论