PDA

View Full Version : adding plugin after creating the table



ser
28 Mar 2011, 12:11 AM
App.TabPanel = Ext.extend(App.TabPanelUi, {
initComponent: function() {
App.TabPanel.superclass.initComponent.call(this);
var grid = this.findByType('editorgrid')[0];
grid.plugins = new Ext.ux.plugins.GroupHeaderGrid({
rows: [[{header: 'groupheader', align: 'center'}]]
});
this.store = new Ext.data.ArrayStore({
data: [['datatest']],
fields: ['name']
});
this.columnModel = new Ext.grid.ColumnModel({
defaults: {
sortable: true,
menuDisabled: true
},
columns: [{header: 'Name', dataIndex: 'name', menuDisabled: true}]
});
grid.reconfigure(this.store, this.columnModel);
grid.addListener('afterrender', this.afterRenderGrid, this);
},
afterRenderGrid: function(grid) {
grid.getView().updateHeaders();
}
}

The table is rendered well, but the plugin does not visible, why?
I'd like to add plug-in after creating the table.

kohyea
28 Mar 2011, 1:37 PM
Try it:


App.TabPanel = Ext.extend(App.TabPanelUi, {
initComponent: function() {
App.TabPanel.superclass.initComponent.call(this);
var grid = this.findByType('editorgrid')[0];
this.groupHeaderPlugin = new Ext.ux.plugins.GroupHeaderGrid({
rows: [[{header: 'groupheader', align: 'center'}]]
});
this.store = new Ext.data.ArrayStore({
data: [['datatest']],
fields: ['name']
});
this.columnModel = new Ext.grid.ColumnModel({
defaults: {
sortable: true,
menuDisabled: true
},
columns: [{header: 'Name', dataIndex: 'name', menuDisabled: true}]
});
grid.reconfigure(this.store, this.columnModel);
grid.addListener('afterrender', this.afterRenderGrid, this);
},
afterRenderGrid: function(grid) {
this.groupHeaderPlugin.init(grid);
grid.getView().updateHeaders();
}
}

ser
28 Mar 2011, 10:42 PM
ok, thanks. I will try it in my next grid. Because I have already done this on a different way.