I am facing problem in adding text area to container dynamically.
Initial creation of container:
xtype: 'container',
layout: 'form',
width: 400,
ref: 'form',
layoutConfig: {
labelSeparator: ' ',
trackLabels: true
},
items: [{
xtype: 'textarea',
value: 'test',
fieldLabel: 'label',
anchor: '100%',
submitValue: false,
readOnly: true,
ref: '../field_1',
id: 'field_1'
}]
}
Dynamic code:
for (i = 4; i < obj.length; i++) {
var id = i + 12;
id = 'field_' + id;
var field = newTextArea(id);
field.setValue(obj[i].value);
field.setVisible(true);
this.form.add(field);
}
Function to create text area:
function newTextArea(id) {
var text_Area = new Ext.form.TextArea({
fieldLabel: 'Test',
height: 30,
width: 250,
submitValue: false,
readOnly: true,
autoScroll: true,
id: id
});
return text_Area;
}
Problem:
When i debug and see form, textarea is added in form items but its not displayed in the browser. Can someone suggest what to do?
Regards,
Raj
Check this simple fiddle.
Not sure what is wrong with your code, you dont mention what is
objand I think thatthis.formis wrong reference to the container. I think you can to use Ext.ComponentQuery.query or something similar (likeupanddownmethods for queryable components).