Search code examples
extjsextjs4extjs4.1

How to get radiogroup checked value using extjs 4?


I am using extjs 4 for radio buttons. Code is as follow

var mychkbxgrp = Ext.create('Ext.form.RadioGroup',{
    fieldLabel: 'Layer',
    columns: 1, 
    items:[{
     boxLabel: 'District', name: 'rb', inputValue: 'district',itemId:"DIS"
    },{
     boxLabel: 'SubDistrict', name: 'rb', inputValue: 'Subdistrict',itemId:"sub"
    },{
     boxLabel: 'Village', name: 'rb', inputValue: 'Village'
    },{
     boxLabel: 'Road', name: 'rb', inputValue: 'Roads'
    },{
     boxLabel: 'Point', name: 'rb', inputValue: 'POINT'
    }],
    listeners: {
     change : function(){ 
         alert(this.getValue());
        }
    }
    });

I want to get the value of checked radio button once its checked. for that i have used listeners but not working. Am i right or need to use other way. please help me for same.


Solution

  • I've tried many solutions, and following one worked only. Hope it helps

    listeners: {
         change : function(obj, value){ 
             alert(value.individual);
            }
        }