-
20 Sep 2010 10:49 PM #1
form in a template
form in a template
Hello all !!
I have a simple question : how to add a form in a template ?
So I have this code working well :
var infos = new Ext.Component({
title: 'Infos',
cls: 'infos',
iconCls: 'user',
scroll: 'vertical',
tpl: [
'<tpl for=".">',
'<p>Utilisateur : '+utilisateur.loginUtilisateur+'</p>',
'</tpl>'
]
});
I want to add a form button in the tpl.
How can I do that ?
thanks !
-
22 Sep 2010 10:20 PM #2
-
22 Sep 2010 11:02 PM #3
No, it's currently not supported to use forms in templates. Why would you want to do that though? Just put the form as a child item of the container.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
11 Nov 2010 12:58 AM #4
-
23 May 2012 5:32 AM #5
Did you ever find a solution?
Did you ever find a solution?
Was a solution found for this?
-
29 Oct 2012 8:30 AM #6
-
30 Oct 2012 11:40 PM #7
I've done something like this. I don't have any simple example, but will describe how it worked:
I have an empty component (Panel), and dynamically add children in a loop. In my case children are form-panel's, so I can load data from some Store or from Ajax call.
Something like this:
Code://parent class: App.views.XParent = Ext.extend(Ext.Panel, { id: 'xParent', layout: 'auto', scroll: 'vertical', items: [ ], }); Ext.reg('xParent', App.views.XParent); //children class: App.views.XChild = Ext.extend(Ext.form.FormPanel, { items:[{ xtype: 'fieldset', items: [ //define fields here ] }] }); Ext.reg('xChild', App.views.xChildren); //Function creating children. createChildren: function(data){ var parent = Ext.getCmp('xParent'); parent.removeAll(); for(var i=0; i<data.length; ++i){ //create component var newCmp = Ext.create({ xtype: 'xChild', id: ('xChild_'+i) //optional }); //load data to form fields newCmp.load(data[i]); newCmp.items.getComponent(0).setTitle('Item nr. '+(i+1)); parent.add(cmp); } parent.doLayout(); }
-
18 Jan 2013 1:40 AM #8
Hey Hi,
I'm new to Sencha
Can you show me how to use setValues() in form.
Please!
Similar Threads
-
Could i get template form html file?
By zsumore in forum Community DiscussionReplies: 0Last Post: 1 Nov 2008, 5:35 PM -
Question about form Template...
By haldrix in forum Ext 2.x: Help & DiscussionReplies: 8Last Post: 7 Oct 2008, 2:45 PM -
Form + Custom Layout, maybe template?
By enterco in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 1 Apr 2008, 11:24 AM -
Help needed !! Template Form
By fredleput in forum Ext 1.x: Help & DiscussionReplies: 7Last Post: 30 Jul 2007, 8:13 AM -
Need: Example on Ext.form together with template
By Joche in forum Ext 1.x: Help & DiscussionReplies: 3Last Post: 24 Apr 2007, 5:13 PM


Reply With Quote
