[pve-devel] [PATCH 2/2] ext5migrate: replace call to private ExtJS function getRoot()

Emmanuel Kasper e.kasper at proxmox.com
Wed Jul 22 10:37:32 CEST 2015


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.
---
 www/manager5/data/ObjectStore.js       | 3 ++-
 www/manager5/data/reader/JsonObject.js | 7 +++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/www/manager5/data/ObjectStore.js b/www/manager5/data/ObjectStore.js
index 935f922..6db1e6c 100644
--- a/www/manager5/data/ObjectStore.js
+++ b/www/manager5/data/ObjectStore.js
@@ -24,7 +24,8 @@ Ext.define('PVE.data.ObjectStore',  {
                 reader: {
 		    type: 'jsonobject',
 		    rows: config.rows,
-		    readArray: config.readArray
+		    readArray: config.readArray,
+		    rootProperty: config.root || 'data'
 		}
             }
         });
diff --git a/www/manager5/data/reader/JsonObject.js b/www/manager5/data/reader/JsonObject.js
index 129c34e..4323e3e 100644
--- a/www/manager5/data/reader/JsonObject.js
+++ b/www/manager5/data/reader/JsonObject.js
@@ -31,8 +31,6 @@ Ext.define('PVE.data.reader.JsonObject', {
     extend: 'Ext.data.reader.Json',
     alias : 'reader.jsonobject',
     
-    root: 'data',
-  
     readArray: false,
 
     rows: undefined,
@@ -50,8 +48,9 @@ Ext.define('PVE.data.reader.JsonObject', {
 
 	var data = [];
         try {
-            var result = Ext.decode(response.responseText);
-	    var root = me.getRoot(result);
+        var result = Ext.decode(response.responseText);
+        // get our data items inside the server response
+        var root = result[me.getRootProperty()];
 
 	    if (me.readArray) {
 
-- 
2.1.4





More information about the pve-devel mailing list