Skip to content
Snippets Groups Projects
Commit 8919126c authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

ExtJS 4.2: polsih the ComboBoxSlave and test several slaves.

parent a3974f77
No related branches found
No related tags found
No related merge requests found
...@@ -25,11 +25,11 @@ dbui.configure_forms(db, plugins=['pFormToolTip']) ...@@ -25,11 +25,11 @@ dbui.configure_forms(db, plugins=['pFormToolTip'])
# #
# harvester selector # harvester selector
# #
# formModifier = dbui.FormModifier('harvester_selector') formModifier = dbui.FormModifier('harvester_selector')
# formModifier.link_comboboxes(master=virtdb.harvester_selector.id_projects, formModifier.link_comboboxes(master=virtdb.harvester_selector.id_projects,
# slave=virtdb.harvester_selector.controller, slave=virtdb.harvester_selector.controller,
# masterHasSlaveData='harvesters') masterHasSlaveData='harvesters')
#
formModifier = dbui.FormModifier('harvester_selector') formModifier = dbui.FormModifier('harvester_selector')
formModifier.link_comboboxes(master=virtdb.harvester_selector.id_projects, formModifier.link_comboboxes(master=virtdb.harvester_selector.id_projects,
slave=virtdb.harvester_selector.id_teams, slave=virtdb.harvester_selector.id_teams,
......
...@@ -149,6 +149,8 @@ Ext.define('App.form.field.ComboBoxSlave', { ...@@ -149,6 +149,8 @@ Ext.define('App.form.field.ComboBoxSlave', {
/** /**
* Select the authorized slave values. * Select the authorized slave values.
* When the number of authorized value is equal to 1, the
* value is loaded in the slave.
* *
* @param {Ext.form.field.ComboBox} combo * @param {Ext.form.field.ComboBox} combo
* @param {Ext.data.Model[]} records * @param {Ext.data.Model[]} records
...@@ -160,10 +162,20 @@ Ext.define('App.form.field.ComboBoxSlave', { ...@@ -160,10 +162,20 @@ Ext.define('App.form.field.ComboBoxSlave', {
var value = records[0].get(this.masterValueField); var value = records[0].get(this.masterValueField);
// clear previous filter
this.store.clearFilter(true); this.store.clearFilter(true);
this.reset(); this.reset();
// filter the local store
this.store.filter(this.masterValueField, value); this.store.filter(this.masterValueField, value);
// enable the widget
this.setDisabled(false); this.setDisabled(false);
// load the value when there is only one
if (this.store.getCount() === 1) {
this.setValue(this.store.getAt(0).get(this.valueField));
}
}, },
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment