1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
var dataSites ;
var dataEntreprises;
Ext.onReady(function(){
function fct_submit(){}
dataEntreprises = new Ext.data.JsonStore
({
url: 'http://192.168.4.214/www/Cartes/fonctions.php?action=getEntreprises',
fields: ['nom']
});
dataEntreprises.load();
dataSites = new Ext.data.JsonStore
({
url: 'http://192.168.4.214/www/Cartes/fonctions.php?action=getSites',
fields: ['site','nom']
});
dataSites.load();
var form_recherche = new Ext.form.FormPanel({
standardSubmit: true,
items: [
{ //Ici, on affiche à la suite tous les champs que l'on veut mettre
xtype: 'combo',
id : 'comboEntreprises',
name : 'comboEntreprises',
store: dataEntreprises,
displayField:'nom',
valueField:'nom',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Selectionner une entreprise ...',
selectOnFocus : true,
listeners:{
select:{
fn:function()
{
form_recherche.getComponent('comboSites').clearValue(); // Voici la ligne concernée
form_recherche.getComponent('comboSites').store.filter('nom',form_recherche.getComponent('comboEntreprises').getValue());
}
}
},
lastQuery:''
},
{
xtype: 'combo',
id : 'comboSites',
name : 'comboSites',
store: dataSites,
displayField:'site',
valueField:'site',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Selectionner un site ...',
selectOnFocus:true,
selectOnFocus : true
},
{
xtype: 'button',
text: 'Rechercher',
handler: fct_submit //fonction à appeler lorsque lon clique sur le bouton
}
]
});
form_recherche.render('recherche');
}); |
Partager