javascript - Extjs 4 cellEditing plugin doesn't work with more then one grid -
i have simple page 2 or more grids , want use cellediting plugin edit cells of grids.
if have grid works well, if make 2 grids (or more) cellediting plugin stop work.
anyone know how solve problem?
i have made little minimized example affected problem.
in example can try add row first grid , double click edit grid. can see cell editing doesn't work @ all. if add , edit cell in second grid, work.
here can found example in jsfiddle: http://jsfiddle.net/eternasparta/amhrr/
and javascript code:
ext.require([ 'ext.form.*', 'ext.tip.*']); var store = ext.create('ext.data.store', { fields: ['label'], data: [] }); ext.define('am.view.editpanel.customlist', { extend: 'ext.container.container', alias: 'widget.sclist', layout: { type: 'vbox', align: 'stretch' }, items: [{ xtype: 'grid', plugins: [], selmodel: { seltype: 'cellmodel' }, tbar: [{ text: 'add', actionid: 'add', handler: function (th, e, earg) { var store = th.up('grid').store; var r = ext.create(store.model.modelname); store.insert(0, r); } }], height: 200, store: store, columns: [{ text: 'name', dataindex: 'label', flex: 1, editor: { xtype: 'numberfield', allowblank: false } }, { xtype: 'actioncolumn', width: 30, sortable: false, actionid: 'delete', header: 'delete', items: [{ tooltip: 'tool' }] }], flex: 1 }], flex: 1, initcomponent: function () { this.items[0].plugins.push(ext.create('ext.grid.plugin.cellediting', { clickstoedit: 2 })); this.callparent(arguments); var sto = ext.create('ext.data.store', { fields: ['label'], data: [] }); this.down('grid').bindstore(sto); this.down('grid').columns[0].text = 'name'; this.down('grid').columns[0].dataindex = 'label'; } }); ext.onready(function () { ext.quicktips.init(); var grid1 = ext.create('am.view.editpanel.customlist', { renderto: ext.getbody() }); var grid2 = ext.create('am.view.editpanel.customlist', { renderto: ext.getbody() }); }); any appreciated, thank you!
just put configs of object or array type (in case - items) inside initcomponent: demo.
for more info see answer here.
Comments
Post a Comment