anaP
29 Aug 2012, 10:44 PM
Hi,
I guess there is some small mistake I am making.
I have a store with autosync true and I am using cell editing plugin for editing grid.
after I change the cell value and click somewhere else my changes are getting lost.
what could be the reason?
here is the code..
view
Ext.define('MyApp.view.MyGridPanel', { extend: 'Ext.grid.Panel',
height: 250,
width: 400,
title: 'My Grid Panel',
store: 'MyArrayStore',
initComponent: function() {
var me = this;
Ext.applyIf(me, {
columns: [
{
xtype: 'gridcolumn',
width: 175,
dataIndex: 'AlertDescription',
editor: 'textfield',
text: 'Alert Description'
}
],
viewConfig: {
},
dockedItems: [
{
xtype: 'button',
handler: function(button, event) {
var MyArrayStore=Ext.getStore('MyArrayStore');
MyArrayStore.load();
},
dock: 'left',
id: 'mybutton',
width: 100,
text: 'MyButton'
}
],
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
ptype: 'cellediting',
clicksToEdit: 1,
listeners: {
validateedit: {
fn: me.onGridcelleditingpluginValidateedit,
scope: me
}
}
})
]
});
me.callParent(arguments);
},
onGridcelleditingpluginValidateedit: function(editor, e, options) {
console.log(editor);
console.log(e);
console.log(options);
}
});
store
Ext.define('MyApp.store.MyArrayStore', { extend: 'Ext.data.Store',
requires: [
'MyApp.model.MyModel1'
],
constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: false,
autoSync: true,
storeId: 'MyArrayStore',
model: 'MyApp.model.MyModel1',
proxy: {
type: 'ajax',
url: 'data/data.json',
reader: {
type: 'array',
root: 'List'
}
}
}, cfg)]);
}
});
I guess there is some small mistake I am making.
I have a store with autosync true and I am using cell editing plugin for editing grid.
after I change the cell value and click somewhere else my changes are getting lost.
what could be the reason?
here is the code..
view
Ext.define('MyApp.view.MyGridPanel', { extend: 'Ext.grid.Panel',
height: 250,
width: 400,
title: 'My Grid Panel',
store: 'MyArrayStore',
initComponent: function() {
var me = this;
Ext.applyIf(me, {
columns: [
{
xtype: 'gridcolumn',
width: 175,
dataIndex: 'AlertDescription',
editor: 'textfield',
text: 'Alert Description'
}
],
viewConfig: {
},
dockedItems: [
{
xtype: 'button',
handler: function(button, event) {
var MyArrayStore=Ext.getStore('MyArrayStore');
MyArrayStore.load();
},
dock: 'left',
id: 'mybutton',
width: 100,
text: 'MyButton'
}
],
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
ptype: 'cellediting',
clicksToEdit: 1,
listeners: {
validateedit: {
fn: me.onGridcelleditingpluginValidateedit,
scope: me
}
}
})
]
});
me.callParent(arguments);
},
onGridcelleditingpluginValidateedit: function(editor, e, options) {
console.log(editor);
console.log(e);
console.log(options);
}
});
store
Ext.define('MyApp.store.MyArrayStore', { extend: 'Ext.data.Store',
requires: [
'MyApp.model.MyModel1'
],
constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: false,
autoSync: true,
storeId: 'MyArrayStore',
model: 'MyApp.model.MyModel1',
proxy: {
type: 'ajax',
url: 'data/data.json',
reader: {
type: 'array',
root: 'List'
}
}
}, cfg)]);
}
});