Skip to content

Instantly share code, notes, and snippets.

@lossendae
Created June 8, 2011 09:50
Show Gist options
  • Save lossendae/1014121 to your computer and use it in GitHub Desktop.
Save lossendae/1014121 to your computer and use it in GitHub Desktop.
Combobox linké
var firstCombo = new Ext.form.ComboBox({
store: store_combo_1,
typeAhead: true,
forceSelection: true,
triggerAction: 'all',
emptyText:'Select a state...',
selectOnFocus:true,
id:'combo1'
});
var secondCombo = new Ext.form.ComboBox({
store: store_combo_2,
typeAhead: true,
forceSelection: true,
triggerAction: 'all',
emptyText:'Select a state...',
selectOnFocus:true,
//Disabled par défaut, si aucune valeur n'est selectionné dans la premiere combo, la seconde n'est pas accessible
disabled:true,
id:'combo2'
});
//On initilaise la premiere combobox
firstCombo.store.load();
firstCombo.on('select', function(){
//Je recupere la valeur du combo 1 lors de la selection
val = this.getValue();
//je load le store de la seconde combo avec la valeur de la premiere
secondCombo.store.load({params:{my_value: val}});
//Je l'a rend accessible
secondCombo.enable();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment