-
5 Jan 2012 3:38 AM #1
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.
Please advice.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; }
Regards,
Suraj
-
5 Jan 2012 7:04 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,710
- Vote Rating
- 436
- Answers
- 3113
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
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
5 Jan 2012 9:54 AM #3
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
-
5 Jan 2012 9:55 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,710
- Vote Rating
- 436
- Answers
- 3113
Suggest you need to debug where that error is happening
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.


Reply With Quote