PDA

View Full Version : [SOLVED] Little problem on combobox cascading



vaucer
9 Feb 2010, 1:17 AM
Hello,

I try to set cascading combobox but i encounter a problem for populate my second combobox with datastore after reloading my datastore.

In fact all is ok for reload datastore params are well sent, but my second is never populate... I don't understand all seem to be OK.

Thank you very much for your little help about this issue on which i search since many times.

My two datastore:

var storeCompo = new Ext.data.Store({
id: 'storeCompo',
autoLoad: true,
proxy: new Ext.data.HttpProxy({
url: 'php/sibes/edit_sibes.php',
method: 'POST'
}),
baseParams:{task: "LISTING"},
reader: new Ext.data.XmlReader({
record: 'response',
id: 'compo'},
[ 'compo' , 'titre'])
});

var storeTitre = new Ext.data.Store({
id: 'storeTitre',
proxy: new Ext.data.HttpProxy({
url: 'php/sibes/edit_sibes.php',
method: 'POST'
}),
reader: new Ext.data.XmlReader({
record: 'response',
id: 'titre'},
[ 'compo' , 'titre'])
});And my two combobox:


{
xtype: 'combo',
id: 'Composants',
fieldLabel: 'Composants',
store: storeCompo,
displayField:'compo',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'----------------------------',
selectOnFocus:false,
anchor:'100%',
listeners: {
'select' : function(cmb, rec, idx) {
Titres = Ext.getCmp('Titres');
Titres.clearValue();
Titres.store.load({
params: {task: "GETITRE",
'id_compo': Ext.getCmp('Composants').getValue()
}
});
Titres.enable();
}
}
}



{
xtype: 'combo',
id: 'Titres',
fieldLabel: 'Titres incidents',
store: storeTitre,
displayField:'titre',
mode: 'local',
triggerAction: 'all',
emptyText:'-----------',
selectOnFocus:false,
anchor:'100%',
disabled: true
}

Thx you very much it's really important for me because im totaly blocked on my projetc :((

And very sorry for my poor english

vaucer
9 Feb 2010, 3:45 AM
it's solved i used store.filter method instead of datastore reload with params.

Now all it's ok.


For information:



{
xtype: 'combo',
id: 'Composants',
fieldLabel: 'Composants',
store: storeCompo,
displayField:'compo',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'----------------------------',
selectOnFocus:false,
anchor:'100%',
listeners: {select:{fn:function(combo, value) {
var Titres = Ext.getCmp('Titres');
Titres.clearValue();
Titres.store.filter('compo', combo.getValue());

}}
}
}