PDA

View Full Version : Extjs toolbar radio group dynamically select



javapurna
25 Oct 2013, 9:52 PM
Hi every one,
how to select toolbar radio group item dynamically . in my case i have a toolbar, in toolbar i am displaying radio group with name A,B ,C. By default is selected and a A related view is rendered. if B is Selected B related view is rendered . same in C case......( A,B, C views are forms )



Ext.define('EXT.Test', {
extend: 'Ext.Panel',
initComponent: function () {
var me = this;
this.initActions();
this.items = this.getItems();
this.superclass.initComponent.apply(this, arguments);
},
initActions: function () {
this.dockedItems = [{
xtype: 'toolbar',
cls: 'addcontact-toolbar',
dock: 'top',
items: [{
xtype: 'radiogroup',
width: '100%',
items: [{
boxLabel:'A' ,
name: 'Type',
inputValue: 'A',
checked: true
}, {
boxLabel:'B',
name: 'Type',
inputValue: 'B',


}, {
boxLabel:'C',
name: 'Type',
inputValue: 'C'
}],
listeners: {
change: function (radiogroup, radio) {
var viewScreen = Ext.getCmp('testTypes');
var viewScreenRemoveScreen = Ext.getCmp('testTypes').items.first();
viewScreen.remove(viewScreenRemoveScreen, true);
var types=null;
switch (radio.eventType) {
case 'A':
types = Ext.create('Ext.A');
break;
case 'B':
types = Ext.create('Ext.B');
break;
case 'C':


types = Ext.create('Ext.C');
break;


}
viewScreen.add(types);
viewScreen.doLayout();
}
}
}]


}];
this.a = Ext.create('Ext.A');
},
getItems: function () {
return [{
items: [{
xtype: 'panel',
border:0,
id: 'testTypes',
items: this.a
}]
}];
}
});




It render like below.(popup window)46572

each radio button click new view is showing .
here is tree panel is there
46573
if i am click on tree node A ,open window and selected A radia group item and render A view.
if i am click on tree node B,open window and selected B radia group item and render B view.
if i am click on tree node C,open window and selected C radia group item and render C view.

mitchellsimoens
28 Oct 2013, 12:51 PM
So you just want to toggle which view is shown on radiogroup change?