I have a array.
var new_data = [['333333.333','44444.222'], ['4444.222','78777.1111']];
I have a store.
var datastore = new Ext.data.ArrayStore({
fields: [
{name: 'X', type: 'float'},
{name: 'Y', type: 'float'}
]
});
datastore.loadData(new_data);
i have a editorgrid.
var cm_koord = new Ext.grid.ColumnModel({
columns: [
{header: "X",
dataIndex:"X",
editor: new Ext.form.TextField({allowBlank: false})
},{
header:"Y",
dataIndex:"Y",
editor: new Ext.form.TextField({allowBlank: false})
}]
})
var koord_tab = new Ext.grid.EditorGridPanel({
title:"Симантика",
store: datastore,
region: 'center',
cm: cm_koord,
//height: 100,
autoScroll: true,
//bbar:[saveButton,cancelButton,editButton]
})
Question: How to save changes after editing? I mean how to save change in new_data
array?
You can use the getRange method on your arrayStore like this:
new_data = [];
Ext.each(datastore.getRange(), function (rec) {
var rec_data = [];
rec.commit();
for (var i in rec.data) {
rec_data.push(rec.data[i]);
}
new_data.push(rec_data);
});
Hope this helps!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.