ExtJS网格面板 - 每行多个"行"?

Che*_*ers 5 grid extjs gridpanel extjs4

我们有一个ExtJS网格面板,它已经增长到包含太多列(imo),所以我正在考虑将一些数据包含到主行的"子行"中.喜欢:

Data1 | Data2 | Data3 | Data4 | Data5
  跨越
Data1 |的一些其他数据 Data2 | Data3 | Data4 | Data5
  跨越的一些额外数据

我知道这个expander插件,但我们不需要扩展/折叠功能,并且总是需要打开子行.

有什么想法或想法吗?

提前致谢.

Dzh*_*zhu 17

如果您使用的是ExtJS-4,

// ...
var rowBodyFeature = Ext.create('Ext.grid.feature.RowBody', {
    getAdditionalData: function(data, rowIndex, record, orig) {
        var headerCt = this.view.headerCt,
        colspan  = headerCt.getColumnCount();
        return {
            rowBody: "HELLO WORLD!", // do something with record
            rowBodyCls: this.rowBodyCls,
            rowBodyColspan: colspan
        };
    }
});

Ext.create('Ext.grid.Panel', {
    // ...
    features: [rowBodyFeature]
    // ...
});
Run Code Online (Sandbox Code Playgroud)

如果使用ExtJS-3,请尝试:

new Ext.grid.GridPanel({
    //...
    viewConfig: {
        enableRowBody: true,
        getRowClass: function(record, rowIndex, p, store) {
            p.body = 'HELLOW WORLD: ' + record.get('attribute');
            return 'x-grid3-row-expanded';
        }
    }
Run Code Online (Sandbox Code Playgroud)