PDA

View Full Version : using cellediting plugin for two grid on one page with different stores



haseeb21
18 May 2011, 10:35 AM
it seems a problem with ext js 4 that when cell editing plugin is used with two grids then grid does not populate .

following is the example

Ext.define('site', {
extend: 'Ext.data.Model',
fields: [{name: 'siteid'},{name: 'description'},{name: 'picevd'},{name: 'Dateofaudit', type: 'date',dateFormat: 'Y-m-d'},{name: 'dateofrecord', type: 'date'},{name: 'id'}]
});

Ext.define('d696', {
extend: 'Ext.data.Model',
fields: [{name: 'siteid'},{name: 'description1'},{name: 'picevd2'},{name: 'Dateofaudit3', type: 'date',dateFormat: 'Y-m-d'},{name: 'dateofrecord4', type: 'date'},{name: 'id'}]
});




var Dstore = Ext.create('Ext.data.Store', {
//autoDestroy: true,
storeId:'Dstore',
autoLoad:true,
model: 'site',
proxy: {url: '../server/sitetheftgrid.php?TYPE=SITE',type: 'ajax',reader: {type: 'json',root: 'results'}},
sorters: [{property: 'Dateofaudit',direction:'ASC'}]
});// END Dstore

Ext.create('Ext.data.Store', {
//autoDestroy: true,
storeId:'a',
model: 'd696',
proxy: {url: '../server/sitetheftgrid.php',type: 'ajax',reader: {type: 'json',root: 'results'}}
sorters: [{property: 'Dateofaudit',direction:'ASC'}]
});// END Dstore



var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {clicksToEdit: 2});

var grid = Ext.create('Ext.grid.Panel', {store: Dstore,
columns: [{id: 'siteid',header: 'Site Id',dataIndex: 'siteid',width:100,field: {allowBlank: false}},
{header: 'Detail',dataIndex: 'description',flex:1,field: {allowBlank: false}},
{header: 'Date Of Audit',dataIndex: 'Dateofaudit',width: 150,field: {xtype: 'datefield',format: 'm/d/y'}},
{header: 'Date Of Record',dataIndex: 'dateofrecord',width: 150}
],
width: '100%',
height: 300,

id:'sitegrid',
frame: true,
plugins: [cellEditing]
});


var stor=Ext.data.StoreManager.lookup('a');


Ext.create('Ext.grid.Panel', {store:stor,
columns: [{header: 'Site Id',dataIndex: 'siteid1',width:100,field: {allowBlank: false}},
{header: 'Detail',dataIndex: 'description2',flex:1,field: {allowBlank: false}},
{header: 'Date Of Audit',dataIndex: 'Dateofaudit3',width: 150,field: {xtype: 'datefield',format: 'm/d/y'}},
{header: 'Date Of Record',dataIndex: 'dateofrecord4',width: 150}
],
width: '100%',
height: 300,
id:'sitegrid2',
frame: true,
autoScroll:true,
when i uncomment this, data in first grid vanishes
/* plugins:[ Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})]*/
});

stephen.friedrich
18 May 2011, 11:43 AM
See answer in help forum.
Please don't double post.