]>
Commit | Line | Data |
---|---|---|
0bb29d35 DM |
1 | /* This store encapsulates data items which are organized as an Array of key-values Objects |
2 | * ie data[0] contains something like {key: "keyboard", value: "da"} | |
3 | * | |
4 | * Designed to work with the KeyValue model and the JsonObject data reader | |
5 | */ | |
01031528 | 6 | Ext.define('Proxmox.data.ObjectStore', { |
0bb29d35 DM |
7 | extend: 'Proxmox.data.UpdateStore', |
8 | ||
73b0150c | 9 | getRecord: function() { |
05a977a2 TL |
10 | let me = this; |
11 | let record = Ext.create('Ext.data.Model'); | |
59db7031 DC |
12 | me.getData().each(function(item) { |
13 | record.set(item.data.key, item.data.value); | |
14 | }); | |
15 | record.commit(true); | |
16 | return record; | |
17 | }, | |
18 | ||
0bb29d35 | 19 | constructor: function(config) { |
05a977a2 | 20 | let me = this; |
0bb29d35 DM |
21 | |
22 | config = config || {}; | |
23 | ||
0bb29d35 DM |
24 | Ext.applyIf(config, { |
25 | model: 'KeyValue', | |
26 | proxy: { | |
27 | type: 'proxmox', | |
28 | url: config.url, | |
29 | extraParams: config.extraParams, | |
30 | reader: { | |
31 | type: 'jsonobject', | |
32 | rows: config.rows, | |
33 | readArray: config.readArray, | |
01031528 TL |
34 | rootProperty: config.root || 'data', |
35 | }, | |
36 | }, | |
0bb29d35 DM |
37 | }); |
38 | ||
39 | me.callParent([config]); | |
01031528 | 40 | }, |
0bb29d35 | 41 | }); |