PDA

View Full Version : Insert component with dom auto created



EvilKnight
19 May 2013, 11:56 PM
For EXTJS 3.4
I am required to use .insert and than doLayout() to insert a component that could be example a textfield. But after the insert, I could not use it component method example: .disable() or .setvalue(''). as it shows error:
Line: 2834
Error: 'this.dom.className' is null or not an object
Checked that the dom is not created under el for Ext.getCmp('exampleId1')

var dynamicComponent = new Ext.form.TextField({ id: 'exampleId1', name: 'exampleName1' });
myPanel.insert(3, dynamicComponent);
myPanel.doLayout();

var CheckboxToDisable= new Ext.form.Checkbox({
boxLabel: 'this a checkbox',
listeners: {
check: function(checkbox, checked)
{
if (checked)
{
Ext.getCmp('exampleId1').disable();
}
else
{
valueControl.enable();
}
}
}

mitchellsimoens
22 May 2013, 7:19 AM
I'm not able to produce an error with this runnable test case:


var panel = new Ext.form.FormPanel({
renderTo : document.body,
height : 200,
tbar : [
{
text : 'Add Text',
handler : function(button) {
var field = new Ext.form.TextField({
fieldLabel : 'foo',
ref : 'field'
});

panel.insert(0, field);

panel.doLayout();

button.disable();

panel.enable.disable();
panel.disable.enable();
}
},
{
text : 'Enable Field',
disabled : true,
ref : '../enable',
handler : function (button) {
panel.field.enable();
panel.disable.enable();

button.disable();
}
},
{
text : 'Disable Field',
disabled : true,
ref : '../disable',
handler : function (button) {
panel.field.disable();
panel.enable.enable();

button.disable();
}
}
]
});