PDA

View Full Version : Dependent multiselects



yegortitov
25 Nov 2009, 2:06 AM
Hi everyone,

first of all excuse my english...

I wouldt like implement 2 dependent multiselects. When i select an item in the multiselect 1, the multiselect 2 muste be filled.

My code :




new Ext.form.ComboBox({
fieldLabel: '<b>Métier *</b> ',
store: typesDossier,
triggerAction:'all',
editable: true,
allowBlank: false,
mode:'local',
displayField:'TYD_NOM',
hiddenName:'tyd_id',
emptyText: 'Sélectionner un métier',
valueField:'TYD_ID',
listeners:{
select:function(obj,record,index){
var themes = Ext.getCmp('themes');
themes.store.loadData(record.data.THEME);
fp.findById('themes').reset();
}
}
}),

{
xtype: 'multiselect',
fieldLabel: '<b>Thèmes *</b>',
id:'themes',
name:'themes',
width: 250,
height: 200,
allowBlank:false,
store: new Ext.data.SimpleStore({
fields: ['THE_ID', 'THE_NOM', 'PTC']
}),
displayField:'THE_NOM',
hiddenName:'the_id',
valueField:'THE_ID',
tbar:[{
text: 'Déselectionner',
handler: function(){
fp.getForm().findField('themes').reset();
}
}],
ddReorder: true,
listeners:{
select:function(obj,record,index){
var pointsControle = Ext.getCmp('pointsControle');
pointsControle.store.loadData(record.data.PTC);
fp.findById('pointsControle').reset();
}
}
},
{
xtype: 'multiselect',
fieldLabel: '<b>Points de contrôle *</b>',
id:'pointsControle',
name:'pointsControle',
width: 250,
height: 200,
allowBlank:false,
store: new Ext.data.SimpleStore({
fields: ['PTC_ID', 'PTC_NOM']
}),
displayField:'PTC_NOM',
hiddenName:'ptc_id',
valueField:'PTC_ID',
tbar:[{
text: 'Déselectionner',
handler: function(){
fp.getForm().findField('pointsControle').reset();
}
}],
ddReorder: true
}


The original store looks like this :



[[3, 'ADHERENTS',[[15, 'THEME TESTA',[[1, 'POINT DE CONTROLE 1'],[28, 'TEST POINT DE CONTROLEXXX']]],[16, '2EME THEMES',[[1, 'POINT DE CONTROLE 1'],[28, 'TEST POINT DE CONTROLEXXX']]]]]]


I join a picture.

Thanks for help