1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    40
    Vote Rating
    0
    pkvenu is on a distinguished road

      0  

    Default Unanswered: fire event on radio field Change and get changed value

    Unanswered: fire event on radio field Change and get changed value


    I am having some issues with the radio field event firing and getting the right values for radio field selected.

    Code:
    // All the Radio Fields are dynamically added into this panel 
    var resultList = Ext.create('Ext.Panel', {
         scrollable: 'vertical',
         width: 285,
         height: 190,
         initialize: function () {
             this.callParent();
             this.element.on({
                 tap: function (ctl) {
                     // var value1 = Ext.ComponentQuery.query("radiofield").getValue();
                     var value = ctl.target.value.split('|');
                     popup.hide();
                     var rtndata = [value[1], value[2]];
                     alert(rtndata);
                 }
             });
         }
     });
    This is the popup which is loaded based on JSON data.
    Code:
     var popup = Ext.create('Ext.Panel', {
         floating: true,
         modal: true,
         centered: true,
         width: 300,
         height: 200,
         layout: 'fit',
         hideOnMaskTap: false,
         items: [resultList]
        
     });
    Store : which loads the popup with radio fields.

    Code:
    Ext.define('Parking.store.Searches', {
        extend: 'Ext.data.Store',
        model: 'Parking.model.LocationSearch',
        remoteFilter: true,
        proxy: {
            type: 'flickr',
            query: 'search',
            reader: {
                type: 'json',
                root: function (data) {
    
    
                    if (data.error || data.Results.Length === 0) {
                        return [];
                    } else {
                        var radios = [];
                        Ext.each(data.Results, function (address) {
                            radios.push({
                                xtype: 'radiofield',
                                name: 'radiogroup',
                                value: address.Representation + "|" + address.Latitude + "|" + address.Longitude,
                                label: address.Representation,
                                labelWidth: '85%'
                            });
                        });
                        resultList.add(radios);
                        popup.show();
                        return data.Results
                    }
                }
            }
        }
    
    
    });
    The Store works perfectly fine and populate the popup with radio fields. Now when i select the radio field i am not able to get the selected value. Can any one help me getting the selected value when the user changes the selection.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,399
    Answers
    3549
    Vote Rating
    849
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The check/uncheck events aren't firing?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    40
    Vote Rating
    0
    pkvenu is on a distinguished road

      0  

    Default


    No. I am not sure whether i have put the listeners in the right position. only the tap event seems to work .

    The resultList contains a group of radio fields. I am basically trying to get the selected field when the user checks a field.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,399
    Answers
    3549
    Vote Rating
    849
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Each radio field will fire the check and uncheck events.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Oct 2011
    Posts
    40
    Vote Rating
    0
    pkvenu is on a distinguished road

      0  

    Default


    Thanks mitchellsimoens. I have been adding the listeners for the radio field in the panel. so it was basically taking the panel values than the radio field. once i adding the listener when i create the radio fields dynamically things started to work.



Thread Participants: 1

Tags for this Thread