2011-04-19 71 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?

如果這不能解決問題,我將不得不看到後端代碼,看看如何處理保存。