pve-manager/www/manager5/data/ObjectStore.js
Emmanuel Kasper 5997aecaef ext5migrate: replace call to private ExtJS function getRoot()
getRoot() semantics changed with ExtJS5.

To avoid further annoyances when ExtJS6 is around the corner, replace the call
to this private method, set rootProperty in the ObjectStore call,
and use the value of rootProperty to filter out the content of the server
answer.
2015-07-22 12:16:18 +02:00

36 lines
868 B
JavaScript

/* This store encapsulates data items which are organized as an Array of key-values Objects
* ie data[0] contains something like {key: "keyboard", value: "da"}
*
* Designed to work with the KeyValue model and the JsonObject data reader
*/
Ext.define('PVE.data.ObjectStore', {
extend: 'PVE.data.UpdateStore',
constructor: function(config) {
var me = this;
config = config || {};
if (!config.storeid) {
config.storeid = 'pve-store-' + (++Ext.idSeed);
}
Ext.applyIf(config, {
model: 'KeyValue',
proxy: {
type: 'pve',
url: config.url,
extraParams: config.extraParams,
reader: {
type: 'jsonobject',
rows: config.rows,
readArray: config.readArray,
rootProperty: config.root || 'data'
}
}
});
me.callParent([config]);
}
});