1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    1
    Vote Rating
    0
    rchen5990@gmail.com is on a distinguished road

      0  

    Default Unanswered: RadioGroup get GroupValue

    Unanswered: RadioGroup get GroupValue


    Hi All,

    I am migrating my Ext JS 3 app to 4 and I am running into a little trouble with radiogroup.

    var testSearchCriteria = Ext.create('Ext.form.Panel',{
    items: [{
    xtype: 'radiogroup',
    fieldLabel: 'Test Search Criteria',
    columns : 1,
    id: 'testSearchCriteria',
    name: 'testSearchCriteria',
    margins : '10 10 10 10',
    items: [
    {boxLabel: 'Test Suite Tango Id', name: 'id-1', inputValue : 'testSuiteTangoId', checked: true},
    {boxLabel: 'Test Case Tango Id', name: 'id-1', inputValue : 'testCaseTangoId'},
    {boxLabel: 'Test Area', name: 'id-1', inputValue : 'testArea'}
    ],
    listeners:{
    change : function(radiogroup,radio){
    if(radio.getGroupValue == 'testSuiteTangoId'){
    testTangoIdSearchKeyTextField.hide();
    testAreaCombo.hide();
    suiteTangoIdTextField.show();
    } else if(radio.getGroupValue == 'testCaseTangoId') {
    testTangoIdSearchKeyTextField.show();
    suiteTangoIdTextField.hide();
    testAreaCombo.hide();
    } else if (radio.getGroupValue() == 'testArea'){
    testTangoIdSearchKeyTextField.hide();
    suiteTangoIdTextField.hide();
    testAreaCombo.show();
    }
    }
    }
    }]
    });


    I get an error Uncaught TypeError: Object #<Object> has no method 'getValue'

    Any help would be greatly appreciated.

    Thanks,
    Rich




  2. #2
    Sencha - Support Team
    Join Date
    Mar 2012
    Location
    Lawrence, KS
    Posts
    281
    Answers
    40
    Vote Rating
    35
    greg.barry has a spectacular aura about greg.barry has a spectacular aura about

      0  

    Default Radio Values

    Radio Values


    You should be able to do something along these lines:

    Code:
    var testSearchCriteria = Ext.create('Ext.form.Panel',{
        items: [{
            xtype: 'radiogroup',
            fieldLabel: 'Test Search Criteria',
            renderTo: Ext.getBody(),
            columns : 1,
            id: 'testSearchCriteria',
            name: 'testSearchCriteria',
            margins : '10 10 10 10',
            items: [
                {boxLabel: 'Test Suite Tango Id', name: 'id-1', inputValue : 'testSuiteTangoId', checked: true},
                {boxLabel: 'Test Case Tango Id', name: 'id-1', inputValue : 'testCaseTangoId'},
                {boxLabel: 'Test Area', name: 'id-1', inputValue : 'testArea'}
            ],
            listeners:{
                change : function(radiogroup,radio){
                    var groupValue = this.getValue()['id-1'];
    
    
                    if(groupValue === 'testSuiteTangoId'){
                        console.log("Radio 1 Checked");
                    } else if(groupValue === 'testCaseTangoId') {
                        console.log("Radio 2 Checked");
                    } else if (groupValue === 'testArea'){
                        console.log("Radio 3 Checked");
                    }
                }
            }
        }]
    });
    Thanks!
    Greg

Thread Participants: 1