[pve-devel] [PATCH manager v3] fix combogrid multiselect bug

Dominik Csapak d.csapak at proxmox.com
Mon May 2 14:35:59 CEST 2016


this fixes a nasty combogrid/multiselect/storeload bug
in which the value of a combogrid gets set to a string instead
of an array, under certain circumstances

we overwrite the getRawValue method of our ComboGrid,
and on multiselect ComboGrids, we just get the value out of
me.rawValue, else we call the method of the parent class

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes since v2:
 * instead of waiting for the store to load in the input panel
   we fix the false behaviour in the combogrid class

i specifically test for multiselect, so that the impact is minimal
this is only the case in exactly the classes where the problem occurs:
pveNodeSelector when mutliselect is on (storages, hagroup)
and groupedit with multiselect (useredit)
 www/manager6/form/ComboGrid.js | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/www/manager6/form/ComboGrid.js b/www/manager6/form/ComboGrid.js
index 7aff5de..bc1b281 100644
--- a/www/manager6/form/ComboGrid.js
+++ b/www/manager6/form/ComboGrid.js
@@ -30,6 +30,25 @@ Ext.define('PVE.form.ComboGrid', {
     // needed to trigger onKeyUp etc.
     enableKeyEvents: true,
 
+    // override ExtJS method
+    // if the field has multiSelect enabled, the store is not loaded, and
+    // the displayfield == valuefield, it saves the rawvalue as an array
+    // but the getRawValue method is only defined in the textfield class
+    // (which has not to deal with arrays) an returns the string in the
+    // field (not an array)
+    //
+    // so if we have multiselect enabled, return the rawValue (which
+    // should be an array) and else we do callParent so
+    // it should not impact any other use of the class
+    getRawValue: function() {
+	var me = this;
+	if (me.multiSelect) {
+	    return me.rawValue;
+	} else {
+	    return me.callParent();
+	}
+    },
+
 // override ExtJS protected method
     onBindStore: function(store, initial) {
         var me = this,
-- 
2.1.4





More information about the pve-devel mailing list