2011-04-19 72 views
1

我想更新记录显示在编辑器grid..but而不是更新相同的记录,新的记录被插入到数据库中...我错过了什么?pllzz help..following是我的JsonStore代码:extjs编辑器网格更新轨道

Ext.data.Api.restActions = { 
create : 'POST', 
read : 'GET', 
update : 'PUT', 
destroy : 'DELETE' }; 

ProdStore = Ext.extend(Ext.data.JsonStore, { 
    constructor: function(cfg) { 
     cfg = cfg || {}; 
     ProdStore.superclass.constructor.call(this, Ext.apply({ 
      storeId: 'ProdStore', 
      id:'ProdStore', 
      url: 'products.json', 
      root: 'proddata', 
      restful:true, 
      idProperty:'id', 
      successProperty:'success', 
      autoLoad:true, 
      autoSave:false, 
      batch:true, 
      writer: new Ext.data.JsonWriter({ 
      encode: false, 
      listful: false, 
      writeAllFields: false}), 

      fields: [ 
       { name:'customer_id'},{ name: 'prodnm'}, 
       { name: 'qty'}, { name: 'rate' }, { name: 'amt'} 
      ] 

     }, cfg)); 
    } 
}); 
new ProdStore(); 

回答

0

存储上设置的idProperty应该是表示数据库中唯一行的字段。在这种情况下可能是customer_id?

如果这不能解决问题,我将不得不看到后端代码,看看如何处理保存。