View Full Version : Is it possible to dynamically add ext object/element below html content of fieldset?

8 Sep 2011, 12:41 AM
I have a fieldset with dynamically genereted html content and I want to add a selectfield to that fieldset.

Everythings going all right, but I want to have this selectfield under html content, but default position of items is over that content.

Is it possible to place this element added by this code:

var myOpt = new Ext.form.Select({
label: 'myTitle',
options: [ { text: 'myOpt1', value: 1} ]


below/under the HTML content of fieldset?

8 Sep 2011, 12:50 AM
Try using doComponentLayout() instead of .doLayout()

8 Sep 2011, 1:23 AM
Thanks for reply.

doLayout() and doComponentLayout() gives me the same result - myOpt component is added to parent component, but it is displayed at the top of that component.

----- TabPanel
----- --- myTab
----- --- --- myFieldset
----- --- --- --- myOpt
----- --- --- --- html (html content of fieldset)

I want to place myOpt selectfield under the html content of fieldset. I found property 'contentEl' of element, but it's not working correctly for me.

Any other ideas?

8 Sep 2011, 5:31 AM
The only way to do this is have your HTML content within a Component that is within your FieldSet.

var fieldset = new Ext.form.FieldSet({
items : [
xtype : 'component',

xtype : 'selectfield',
label : 'myTitle',
name : 'title',
options : [ { text: 'myOpt1', value: 1} ]

As a side note, try only using getCmp for as a debugging tool. Utilize ComponentQuery to get references of Components:

form.down('fieldset'); //get first child match
form.query('fieldset'); //get all children matches
fieldset.up('form'); //get first parent match

8 Sep 2011, 5:44 AM
It's exactly what I was looking for. Thank You very much.