1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    19
    Vote Rating
    0
    suraj.breezy is on a distinguished road

      0  

    Default Unanswered: Change event of toggle field not getting triggered

    Unanswered: Change event of toggle field not getting triggered


    Hello All,

    I am ausing ST 2 with chrome. I am using togglefield and i want to track the toggle change event, However the change is not getting triggered. Please find the sample code i am using.

    Code:
    function displayLayers(){
        function createLayerItem(layerName){
            return Ext.create('Ext.field.Toggle',{
                name: layerName,
                label: layerName,
                labelWidth: '60%',
                width: 275,
                value: 1,
                listeners:{
                    change: function(me,value, Object){
                        alert(value);
                    }
                }
            });
        }
    
    
        Layers = Ext.create('Ext.form.Panel', {
            floating        : true,
            modal           : true,
            hidden          : true,
            width           : 350,
            height          : 300,
            styleHtmlContent: true,
            items: [{
                    docked: 'top',
                    xtype : 'toolbar',
                    title : 'Layers'
            }],
            scrollable: true
        });
    
        if(window.svgViewer != undefined){
            LayerInfoArray = window.svgViewer.GetLayers();
            if(LayerInfoArray != undefined){
                for(var i = 0; i <= LayerInfoArray.length - 1; i ++){
                    layerItem = createLayerItem(LayerInfoArray[i]);
                    Layers.add(layerItem);
                }
            }
        }
        return Layers;
    }
    Please advice.

    Regards,

    Suraj

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Answers
    3541
    Vote Rating
    847
    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


    Using PR3 release, this works for me:

    Code:
    Ext.create('Ext.Container', {
        fullscreen : true,
        items      : [
            {
                xtype     : 'togglefield',
                label     : 'Select Two',
                listeners : {
                    change : function() {
                        console.log('change');
                    }
                }
            }
        ]
    });
    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
    May 2011
    Posts
    19
    Vote Rating
    0
    suraj.breezy is on a distinguished road

      0  

    Default Issue after upgrading to ST2 PR3

    Issue after upgrading to ST2 PR3


    Hello mitchellsimoens,

    Thank you for your quick response. I was using ST2 PR 1 i guess. When i upgraded to ST2 PR 3 all the UI collapsed i am getting an error "
    Uncaught TypeError: Cannot call method 'setWidth' of undefined". Please find the attachment before using ST pr3 and after using PR 3. Please suggest.

    Regards,

    Suraj
    Attached Images

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Answers
    3541
    Vote Rating
    847
    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


    Suggest you need to debug where that error is happening
    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.

Thread Participants: 1