-
9 Nov 2011 10:34 AM #1
adding listeners to x template
adding listeners to x template
Hi guys,
I am having some problem with adding listeners to x template and get the value of the selected radio control when a select button is clicked . can some one help me with it.
I have a template which gets its values JSON. The template basically adds a list of radio buttons to the panel. as shown below
The result list is bound to a popup windowCode:var popupResultTemplate = new Ext.XTemplate( '<tpl for=".">', '<div>', '<input id={Representation} type="radio" name="group1" value="{Representation}" /> {Representation} <br />', '<div>', '</tpl>' );
Code:var resultList = new Ext.Panel({ scroll: 'vertical', tpl: popupResultTemplate });
Thanks,Code:var popup = new Ext.Panel({ floating: true, centered: true, modal: true, width: 300, height: 400, dockedItems: [ { xtype: 'toolbar', title: 'PopUp', items: [{ xtype: 'spacer' }, { text: 'Close', handler: function () { popup.hide(); } }] }, { xtype: 'toolbar', items: [{ xtype: 'spacer' }, { xtype:'button', cls: 'citySearch', text: 'Select', handler: function () { Ext.dispatch({ controller: parking.controllers.controller, action: 'showMapBasedOnInputLocation', }); } }] } ], items: [resultList] });
Pawan
-
10 Nov 2011 5:20 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,682
- Vote Rating
- 435
Not tested at all but something along the lines of:
Code:panel.mon(panel.body, { delegate: 'input', click: someFn });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.
-
10 Nov 2011 8:24 AM #3
I could'nt get the method to work as per your suggestion. I added something like this for me to get it working
Hope it helps some one.Code:var resultList = new Ext.Panel({ scroll: 'vertical', tpl: popupResultTemplate, listeners: { el: { tap: function (ctl) { alert("Checked " + ctl.target.value); }, delegate: "input" } } });
Thanks,
Pawan


Reply With Quote