Skip to content

Instantly share code, notes, and snippets.

@ideesimple
Forked from lossendae/linked_combobox.js
Created June 8, 2011 10:34
Show Gist options
  • Save ideesimple/1014179 to your computer and use it in GitHub Desktop.
Save ideesimple/1014179 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