[pve-devel] [PATCH manager v2] fix combogrid multiselect bug
Dominik Csapak
d.csapak at proxmox.com
Tue Apr 26 13:51:22 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
instead of simply setting the loaded value to the fields,
we check if the store has loaded
if it has not, we add a callback instead,
which does this after the store has loaded
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/manager6/panel/InputPanel.js | 19 +++++++++++++++----
www/manager6/window/Edit.js | 19 +++++++++++++++----
2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/www/manager6/panel/InputPanel.js b/www/manager6/panel/InputPanel.js
index 8ab1e33..fa0a920 100644
--- a/www/manager6/panel/InputPanel.js
+++ b/www/manager6/panel/InputPanel.js
@@ -35,10 +35,21 @@ Ext.define('PVE.panel.InputPanel', {
Ext.iterate(values, function(fieldId, val) {
var field = me.query('[isFormField][name=' + fieldId + ']')[0];
if (field) {
- field.setValue(val);
- if (form.trackResetOnLoad) {
- field.resetOriginalValue();
- }
+ if (field.store && !field.store.isLoaded()) {
+ // since setting the value before the store loads
+ // can be problematic, we set it after
+ field.store.onAfter('load', function(){
+ field.setValue(val);
+ if (form.trackResetOnLoad) {
+ field.resetOriginalValue();
+ }
+ });
+ } else {
+ field.setValue(val);
+ if (form.trackResetOnLoad) {
+ field.resetOriginalValue();
+ }
+ }
}
});
},
diff --git a/www/manager6/window/Edit.js b/www/manager6/window/Edit.js
index e150cf1..9bcd705 100644
--- a/www/manager6/window/Edit.js
+++ b/www/manager6/window/Edit.js
@@ -59,10 +59,21 @@ Ext.define('PVE.window.Edit', {
Ext.iterate(values, function(fieldId, val) {
var field = form.findField(fieldId);
if (field && !field.up('inputpanel')) {
- field.setValue(val);
- if (form.trackResetOnLoad) {
- field.resetOriginalValue();
- }
+ if (field.store && !field.store.isLoaded()) {
+ // since setting the value before the store loads
+ // can be problematic, we set it after
+ field.store.onAfter('load', function(){
+ field.setValue(val);
+ if (form.trackResetOnLoad) {
+ field.resetOriginalValue();
+ }
+ });
+ } else {
+ field.setValue(val);
+ if (form.trackResetOnLoad) {
+ field.resetOriginalValue();
+ }
+ }
}
});
--
2.1.4
More information about the pve-devel
mailing list