ExtJS. Ext.data.DirectStore send null data to server after grid is updated

I have a problem with saving data from Ext.data.DirectStore to server Here is my code: 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); } }); After editing the grid pushing `Apply` button I can see in firebug such POST data: {"action":"AbonApi","method":"cities_update","data":null,"type":"rpc","tid":7} Why `data` is null and where is my changes to grid? I'm doing something wrong or this is a bug **UPDATED:** Ext.ux.CityGrid ... cutted out ... tbar: [{ text: 'Apply', handler: function() { modified = this.store.getModifiedRecords(); console.log(modified) this.store.save() }, scope: this }], ... cutted out ... I can see modified data in console before store is saved. and this data is not passing to the server;
I'd guess that it's not recording the changes for whatever reason. Add a listener to the save event, see what store.getModifiedRecords() gives you after editing?

以上就是ExtJS. Ext.data.DirectStore send null data to server after grid is updated的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏