[pve-devel] [PATCH manager 4/6] snapshottree: remove sorter before saving the state

Dominik Csapak d.csapak at proxmox.com
Tue Dec 6 16:26:40 CET 2016


extjs saves the state including the sorter, but cannot serialize the
sorter function. when restoring the state, it is not a valid sorter,
so we delete it before saving

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/lxc/SnapshotTree.js  | 9 +++++++++
 www/manager6/qemu/SnapshotTree.js | 9 +++++++++
 2 files changed, 18 insertions(+)

diff --git a/www/manager6/lxc/SnapshotTree.js b/www/manager6/lxc/SnapshotTree.js
index 8969e97..df5b31c 100644
--- a/www/manager6/lxc/SnapshotTree.js
+++ b/www/manager6/lxc/SnapshotTree.js
@@ -96,6 +96,15 @@ Ext.define('PVE.lxc.SnapshotTree', {
 
     },
 
+    listeners: {
+	beforestatesave: function(grid, state, eopts) {
+	    // extjs cannot serialize functions,
+	    // so a the sorter with only the sorterFn will
+	    // not be a valid sorter when restoring the state
+	    delete state.storeState.sorters;
+	}
+    },
+
     initComponent: function() {
 	var me = this;
 
diff --git a/www/manager6/qemu/SnapshotTree.js b/www/manager6/qemu/SnapshotTree.js
index c35b9c0..ea14d0f 100644
--- a/www/manager6/qemu/SnapshotTree.js
+++ b/www/manager6/qemu/SnapshotTree.js
@@ -94,6 +94,15 @@ Ext.define('PVE.qemu.SnapshotTree', {
 
     },
 
+    listeners: {
+	beforestatesave: function(grid, state, eopts) {
+	    // extjs cannot serialize functions,
+	    // so a the sorter with only the sorterFn will
+	    // not be a valid sorter when restoring the state
+	    delete state.storeState.sorters;
+	}
+    },
+
     initComponent: function() {
         var me = this;
 
-- 
2.1.4





More information about the pve-devel mailing list