-
21 Dec 2011 2:28 AM #1
PR3: form.Panel isn't displayed?
PR3: form.Panel isn't displayed?
Hi I am using Sencha Touch PR3. I have a Panel which contains another Panel with html content and a form.Panel. The form.Panel contains a form.FieldSet. The panel with html content is displayed. But the form.Panel (=panelLogin) is not visible. Why? In Sencha Touch 1.x it works. Thanks in advance.
Code:var fsLogIn = Ext.create('Ext.form.FieldSet', { title : 'Enter login data', items : [{ xtype : 'textfield', name : 'sessionName', label : 'Session' }] }); var panelLogin = Ext.create('Ext.form.Panel', { standardSubmit : false, items : [fsLogIn, { xtype : 'button', text : 'Login', ui : 'action', scope : this, handler : function() { panelLogin.submit(); }, }], submit : function() { //do something } }); Ext.define('VoteApp.view.LoginView', { extend : 'Ext.Panel', xtype : 'voteapp-loginview', config : { items : [{ xtype : 'panel', html : 'Test', height : 90 }, panelLogin] }, });
-
21 Dec 2011 6:21 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,627
- Vote Rating
- 435
I wouldn't use Ext.create outside of Ext.setup. I wouldn't use Ext.define inside of Ext.setup. You can simplify your code by combining into one:
But the problem is your form needs a height either by setting the height config on the formpanel or by using a layout. I would choose to use a layout:Code:Ext.define('VoteApp.view.LoginView', { extend : 'Ext.Panel', xtype : 'voteapp-loginview', config : { items : [ { xtype : 'panel', html : 'Test', height : 90 }, { xtype : 'formpanel', items : [ { xtype : 'fieldset', title : 'Enter login data', items : [ { xtype : 'textfield', name : 'sessionName', label : 'Session' }, { xtype : 'button', text : 'Login', ui : 'action', handler : function(btn) { var form = btn.up('formpanel'); form.submit(); } } ] } ] } ] } });
Please notice the lines in red. Now you should be able to see the form.Code:Ext.define('VoteApp.view.LoginView', { extend : 'Ext.Panel', xtype : 'voteapp-loginview', config : { layout : { type : 'vbox', align : 'stretch' }, items : [ { xtype : 'panel', html : 'Test', height : 90 }, { xtype : 'formpanel', flex : 1, items : [ { xtype : 'fieldset', title : 'Enter login data', items : [ { xtype : 'textfield', name : 'sessionName', label : 'Session' }, { xtype : 'button', text : 'Login', ui : 'action', handler : function(btn) { var form = btn.up('formpanel'); form.submit(); } } ] } ] } ] } });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.
-
28 Dec 2011 6:09 AM #3
Great, this works!
But this little thing isn't working anymore (works in 1.x)
This sets the default text of the textfield to ABC. The user can modify it. ButCode:{ xtype : 'textfield', name : 'sessionName', label : 'Session', value : 'ABC' }
always returns ABC. The user input is ignored.Code:form.getFields('sessionName').getValue();
Second bug: The form can't be posted with if you hit the enter/return key while the textfield has the focus.
-
28 Dec 2011 6:19 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,627
- Vote Rating
- 435
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