[pve-devel] [PATCH manager 4/4] do not disable a combogrid when it loads

Dominik Csapak d.csapak at proxmox.com
Fri Apr 22 10:00:47 CEST 2016


instead of disabling a combogrid when its store loads,
we make the gridpanel bigger, to show its loading mask

since we do not disable/enable anymore, we have no reason
to suspend/resume the validitychange event anymore

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/form/ComboGrid.js | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/www/manager6/form/ComboGrid.js b/www/manager6/form/ComboGrid.js
index 97b3b43..33f3059 100644
--- a/www/manager6/form/ComboGrid.js
+++ b/www/manager6/form/ComboGrid.js
@@ -215,6 +215,18 @@ Ext.define('PVE.form.ComboGrid', {
 	    });
 	}
 
+	// when our store is not yet loaded, we increase
+	// the height of the gridpanel, so that we can see
+	// the loading mask
+	//
+	// we save the minheight to reset it after the load
+	picker.on('show', function() {
+	    if (me.enableAfterLoad) {
+		me.savedMinHeight = picker.getMinHeight();
+		picker.setMinHeight(100);
+	    }
+	});
+
         picker.getNavigationModel().navigateOnSpace = false;
 
         return picker;
@@ -245,9 +257,6 @@ Ext.define('PVE.form.ComboGrid', {
 
 	me.mon(me.store, 'beforeload', function() {
 	    if (!me.isDisabled()) {
-		// prevent user input and field validation until the store is successfully loaded
-		me.suspendEvent('validitychange');
-		me.setDisabled(true);
 		me.enableAfterLoad = true;
 	    }
 	});
@@ -259,9 +268,11 @@ Ext.define('PVE.form.ComboGrid', {
 
 		if (me.enableAfterLoad) {
 		    delete me.enableAfterLoad;
-		    me.setDisabled(false);
-		    me.resumeEvent('validitychange');
-		    me.isValid(); // if field was disabled then reenabled, validation status was lost
+		    if (me.picker) {
+			me.picker.setMinHeight((me.savedMinHeight)?me.savedMinHeight:0);
+			delete me.savedMinHeight;
+			me.picker.updateLayout();
+		    }
 		}
 
 		var def = me.getValue() || me.preferredValue;
-- 
2.1.4





More information about the pve-devel mailing list