[pve-devel] [PATCH pve-manager 3/3] ext6migrate: fix IPRefSelector ComboGrid

Emmanuel Kasper e.kasper at proxmox.com
Thu Feb 4 14:46:39 CET 2016


The IPrefSelector ComboGrid can have selected values which are not backed
by the component store, ie the store only contains IP aliases, but
the ComboGrid can contain an IP adress not registered as an IP alias.

In that case we should not try to update the selection in the dropdown,
as the dropdown only knows about the component store.

Implementation is similar to the syncSelection() private method of the
ExtJS4 ComboBox.
---
 www/manager6/form/ComboGrid.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/www/manager6/form/ComboGrid.js b/www/manager6/form/ComboGrid.js
index 6a90860..dedf259 100644
--- a/www/manager6/form/ComboGrid.js
+++ b/www/manager6/form/ComboGrid.js
@@ -52,12 +52,13 @@ Ext.define('PVE.form.ComboGrid', {
 
         var grid = Ext.create('Ext.grid.Panel', config);
 
-        // update the grid with the field values when loading
+        // if we have value(s) in the textField, mark them as selected in the picker
         if (me.getRawValue()){
             var previousItems = [];
             Ext.Array.each(me.getRawValue().split(','), function(record) {
                 var previousItem = me.store.findRecord(me.valueField, record);
-                previousItems.push(previousItem);
+                // select only what can be found in the ComboGrid store
+                previousItem != null && previousItems.push(previousItem);
             });
 
             grid.getSelectionModel().select(previousItems);
-- 
2.1.4





More information about the pve-devel mailing list