]> git.proxmox.com Git - proxmox-widget-toolkit.git/blobdiff - data/ObjectStore.js
use eslint and execute as check target
[proxmox-widget-toolkit.git] / data / ObjectStore.js
index 1e3771f6d7b62a1d7379af3f2e51065c41674989..860cbfdb755b9345d321c897f456fc2c2be4e6e1 100644 (file)
@@ -3,16 +3,26 @@
 *
 * Designed to work with the KeyValue model and the JsonObject data reader
 */
-Ext.define('Proxmox.data.ObjectStore',  {
+Ext.define('Proxmox.data.ObjectStore', {
     extend: 'Proxmox.data.UpdateStore',
 
+    getRecord: function() {
+       let me = this;
+       let record = Ext.create('Ext.data.Model');
+       me.getData().each(function(item) {
+           record.set(item.data.key, item.data.value);
+       });
+       record.commit(true);
+       return record;
+    },
+
     constructor: function(config) {
-       var me = this;
+       let me = this;
 
         config = config || {};
 
        if (!config.storeid) {
-           config.storeid =  'proxmox-store-' + (++Ext.idSeed);
+           config.storeid = 'proxmox-store-' + ++Ext.idSeed;
        }
 
         Ext.applyIf(config, {
@@ -25,11 +35,11 @@ Ext.define('Proxmox.data.ObjectStore',  {
                    type: 'jsonobject',
                    rows: config.rows,
                    readArray: config.readArray,
-                   rootProperty: config.root || 'data'
-               }
-            }
+                   rootProperty: config.root || 'data',
+               },
+            },
         });
 
         me.callParent([config]);
-    }
+    },
 });