1
を更新している私はここで、サーバExtJS。 Ext.data.DirectStoreグリッドの後に、サーバーにnullのデータを送信
にExt.data.DirectStoreからのデータの保存の問題は私のコードでいます
new Ext.data.DirectStore({
api: {
read: AbonApi.cities,
create: AbonApi.cities_create,
update: AbonApi.cities_update,
destroy: AbonApi.cities_destroy
},
paramsAsHash: false,
autoSave: false,
storeId: 'cities-store',
reader: new Ext.data.JsonReader({
root: 'data',
idProperty: 'id',
fields: [
'id',
'name',
'label',
'comment',
]
}),
writer: new Ext.data.JsonWriter({
encode: true,
writeAllFields: true,
listful: true
})
});
Ext.ux.CityGrid = Ext.extend(Ext.grid.EditorGridPanel,{
initComponent: function(){
var config = {
frame:true,
title: 'Cities',
height:200,
width:500,
store: 'cities-store',
closable: true,
tbar: [{
text: 'Apply',
handler: function() {
this.store.save()
},
scope: this
}],
columns: [
{header: "Id", dataIndex: 'id', editor: new Ext.form.TextField()},
{header: "Name", dataIndex: 'name', editor: new Ext.form.TextField()},
{header: "Label", dataIndex: 'label', editor: new Ext.form.TextField()},
{header: "Comment", dataIndex: 'comment', editor: new Ext.form.TextField()},
],
onRender:function() {
Ext.ux.CityGrid.superclass.onRender.apply(this, arguments);
this.store.load();
}
}
Ext.apply(this, Ext.apply(this.initialConfig, config));
Ext.ux.CityGrid.superclass.initComponent.apply(this, arguments);
}
});
編集した後私は放火犯なPOSTデータで見ることができるApply
ボタンを押すグリッド:
{"action":"AbonApi","method":"cities_update","data":null,"type":"rpc","tid":7}
data
がnullで、どこグリッドへの私の変更があるのはなぜ?ストアが保存される前に、私は、コンソールで変更されたデータを見ることができます
Ext.ux.CityGrid
... cutted out ...
tbar: [{
text: 'Apply',
handler: function() {
modified = this.store.getModifiedRecords();
console.log(modified)
this.store.save()
},
scope: this
}],
... cutted out ...
: は私が更新何か間違ったことか、これはバグです
よ。このデータはサーバーに渡されません。
私はそれが何らかの理由で変更を記録していないと思います。リスナーを 'save'イベントに追加します。' store.getModifiedRecords() 'が編集後にあなたに与えるものを参照してください。 – wombleton
store.getModifiedRecords()は正常です。私はコンソールで変更されたオブジェクト(行)のリストを見ることができます。 – Shamanu4