aqui es donde creo la ventana
Código Javascript:
Ver original
Ext.ns("com.quizzpot.tutorial"); com.quizzpot.tutorial.LinkedComboBoxTutorial = { init: function(){ this.countryStore = this.getStore(); this.stateStore = this.getStore(); this.cityStore = this.getStore(); this.countryCmb = new Ext.form.ComboBox({ store: this.countryStore, id: 'country', valueField: 'value', displayField: 'label', triggerAction: 'all', emptyText: 'Select a Country', fieldLabel: 'Country' }); this.stateCmb = new Ext.form.ComboBox({ store: this.stateStore, disabled: true, id: 'state', valueField: 'value', displayField: 'label', triggerAction: 'all', mode: 'local', emptyText: 'Select a Contry first', fieldLabel: 'State' }); this.cityCmb = new Ext.form.ComboBox({ store: this.countryStore, disabled: true, id : 'city', valueField: 'value', displayedField: 'label', triggerAction: 'all', //mode: 'local', emptyText: 'Select a State first', fieldLabel: 'City' }); this.window = new Ext.Window({ title: 'Linked ComboBox', layout:'form', width:300, height:200, bodyStyle: 'padding:5px;background-color:#fff', items: [this.countryCmb,this.stateCmb,this.cityCmb] }); this.window.show(); this.countryCmb.on('select',function(cmb,record,index){ this.stateCmb.enable(); this.stateCmb.clearValue(); this.stateStore.load({params:{id:record.get('value')}}); },this); this.stateCmb.on('select',function(cmb,record,index){ this.cityCmb.enable(); this.cityCmb.clearValue(); this.cityStore.load({params:{id2:record.get('value')}}) },this); }, getStore: function(){ var store = new Ext.data.JsonStore({ url:'linked-cmb.php', root:'data', fields: ['value','label'] }); return store; } } Ext.onReady(com.quizzpot.tutorial.LinkedComboBoxTutorial.init,com.quizzpot.tutorial.LinkedComboBoxTutorial);
y este es el codigo php que me devuelve el valor que debe ir en los combos
Código PHP:
Ver original
<?php ); ); $id = $_REQUEST['id']; $idd=$_REQUEST['id2']; if($id==""){ echo toJSON($countries); } if($id!=""){ echo toJSON($states[$id]); } if($idd!=""){ echo toJSON($cities[$idd]); } function toJSON($array){ $i=0; foreach($array as $key=>$value){ 'value'=>$i++, 'label'=>$value )); } 'total'=>$total, 'data'=>$data )); } ?>
con eso solamente consigo que se carguen los primeros dos combos, y no se que hago mal que el tercero no carga....
muchas gracias de antemano