-
23 Dec 2012 6:14 AM #1
Answered: Need help with Calculator app
Answered: Need help with Calculator app
Hello,
I am new to Sencha touch and trying to develop a calculator App. How can send the value of button to text field.
The code i have so far
skumarCode:Ext.define('MyApp.view.MyPanel', { extend: 'Ext.Panel', config: { items: [ { xtype: 'button', id: 'one', itemId: 'mybutton', text: '1' }, { xtype: 'textfield', label: 'Field' } ], listeners: [ { fn: 'onButtonTap', event: 'tap', delegate: '#one' } ] }, });
-
Best Answer Posted by mitchellsimoens
You can resolve the text field with ComponentQuery:
Code:onButtonTap : function(button) { var panel = button.up('panel'), field = panel.down('textfield'); field.setValue(button.getText()); }
-
26 Dec 2012 8:05 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
- Answers
- 3106
You can resolve the text field with ComponentQuery:
Code:onButtonTap : function(button) { var panel = button.up('panel'), field = panel.down('textfield'); field.setValue(button.getText()); }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.
-
27 Dec 2012 8:34 PM #3


Reply With Quote