PDA

View Full Version : dependent combobox



SebastienLorenzo
19 Oct 2012, 6:20 AM
i had a problem with the loadData() function in my dependent combobox.I'm doing a desk where I can create shortcuts and modify them.
The problem occurs when trying to modify the shortcut and pass "Tab con URL" to "Tab con Info de sistema". Detects an error in the loadData function when I choose the combo with id="sistemas". No data load brings me function GetMenu in the store.The data that returns the GetMenu function isn't loaded to the store.
I dont know why. Here is my code, can anyone lend me a hand?






{
xtype : "radio",
boxLabel : "Tab con Info de sistema",
value : "oneway",
tabIndex : 1,
id :'IdCheck',
name : "rt_rt_radiobutton",
listeners: {
check: function(){
Ext.getCmp("sistemas").enable();
Ext.getCmp("iconUrl").disable();
}
}
},


{
xtype:"radio",
boxLabel:"Tab con URL",
value:"twoway",
id: 'idCheckedUrl',
tabIndex:1,
name:"rt_rt_radiobutton",
listeners: {
check: function (ctl, val) {
if(val){
Ext.getCmp("iconUrl").enable();
Ext.getCmp("sistemas").disable();
Ext.getCmp("sistemas").clearValue();
Ext.getCmp("menus").clearValue();
Ext.getCmp("items").clearValue();
Ext.getCmp("subMenu").clearValue();
Ext.getCmp("menus").disable();
Ext.getCmp("items").disable();
Ext.getCmp("subMenu").disable();
}
}
}
},
{
xtype : 'combo',
store : cmb_sistemas,
hiddenName : 'id_sistema',
allowBlank : false,
value : sistemId,
mode : 'local',
fieldLabel : 'Sistemas',
disabled : true,
name : 'sistemas',
id : 'sistemas',
anchor : '90%',
displayField : 'sistema',
triggerAction: 'all', //rdiaz
emptyText : 'Seleccione un sistema',//rdiaz
editable : false, //rdiaz
valueField : 'id',
listeners : {
select: function (){
idSistema = this.getValue();
nombreSistema= this.getRawValue();
var menu = Ext.getCmp("menus");
iMenu = getMenu(idSistema);
//menu.store.clear();
menu.store.loadData(iMenu, true);
menu.enable();
var items = Ext.getCmp("items");
//menu.clearValue();
//menu.store.removeAll();//rdiaz
items.clearValue();
items.disable();
var subMenues= Ext.getCmp("subMenu");
subMenues.clearValue();
subMenues.disable();
}
}
},
{
xtype : 'combo',
store : cmb_menu,
hiddenName : 'id',
valueField : 'id',
value : menuID,
mode : 'local',
allowBlank : false,
fieldLabel : 'menu',
disabled : true,
triggerAction: 'all',//rdiaz
emptyText : 'Seleccione un menu',//rdiaz
editable : false, //rdiaz
name : 'menus',
id : 'menus',
anchor : '90%',
displayField : 'menu',
listeners : {
select: function () {
selectedMenu = this.getValue();
Ext.getCmp("subMenu").clearValue();
//alert(selectedMenu);
idSistema = Ext.getCmp("sistemas").getValue();
mItems = getItemsMenu(selectedMenu, idSistema);
if($.trim(selectedMenu) == "000060000000010000"){
var subMenues= Ext.getCmp("subMenu");
subMenues.store.loadData(mItems);
subMenues.enable();
var items = Ext.getCmp("items");
items.clearValue();
items.enable();
}else{
var subMenues= Ext.getCmp("subMenu");
subMenues.store.loadData(mItems);
subMenues.disable();
var items = Ext.getCmp("items");
//alert(mItems);
items.store.loadData(mItems);
items.clearValue();
items.enable();
}
}

}
},







Thanks you!

SebastienLorenzo
19 Oct 2012, 6:30 AM
This Store:


var cmb_menu = new Ext.data.SimpleStore({
fields : ['id', 'menu'],
data : menu
});


someone help me with this problem?
Thanks!!