2013-05-17 11 views
0

的車型名單我有這樣一個模型:ExtJS的配置店內寫在屬性名

Ext.define('Policy', { 
    extend: 'Ext.data.Model', 

    fields: [ 
     { 
      name: 'id', 
      type: 'sting', 
      phantom: true, 
      convert: function(value, record) { 
       return record.get('a') + '@' + 
        record.get('b'); 
      } 
     }, 
     {name: 'a', type: 'string'}, 
     {name: 'b', type: 'string'}] 
}); 

每條記錄​​的PK是ab。這家店看起來是這樣的:

Ext.define('Store', { 
    extend: 'Ext.data.Store', 
    model: 'Policy', 
    autoLoad: true, 

    proxy: { 
     type: 'rest', 
     simpleSortMode: true, 
     batchActions: true, 
     reader: { 
      type: 'json', 
      root: 'data', 
      idProperty: 'id' 
     }, 
     writer: { 
      nameProperty: 'mapping' 
     }, 
     api: { 
      create:'/batch', 
      read: '/policies', 
      update: '/batch', 
      destroy: '/batch' 
     } 
    } 
}); 

我如何配置存儲,以便當調用store.sync()當員額/批,有效載荷是這樣的,只包含髒記錄

{ 
    "policies": [{ 
     "a": "AA", 
     "b": "BB", 
    }, { 
     "a": "AAA", 
     "b": "BBB" 
    },...] 
} 

其中有一個policies屬性,在它下面是一個髒策略數組。

回答

0

您可以通過手動撥打Ext.Ajax()來創建任何您想要的結構。你必須自己提交髒記錄。