PDA

View Full Version : Set items of Panel after creation



hobbes
7 Jun 2008, 1:34 AM
Hi,

I try so put dynamically created checkboxes (by function getAccCheckboxes()) into the panel "dmAddressNs.TabAccessible" with line at the bottom:
dmAddressNs.TabAccessible.items = dmAddressNs.CheckboxArray;

But the checkboxes are not shown here.
The array itself should be correct.
If i prepare this before, it works (see comment: items: dmAddressNs.CheckboxArray).
But I must insert them later because they are generated by an ajax request.
Does somebody see the error?
Thank you!
Regards, Dirk


dmAddressNs.TabAccessible = new Ext.Panel({
id:'idTabAccessible',
layout: 'form',

//items: dmAddressNs.CheckboxArray,
//...
});

var arrAccOptions = [];

function getAccCheckboxes(){
var arrChB = [];
for (var i = 0; i < 4; i++) {
arrChB[i] = new Ext.form.Checkbox({
fieldLabel: 'test' + i,
tabIndex: 1,
checked: true,
name: 'acctest_1',
});
}

return arrChB;
}

// Try to set item - property-but checkboxes are not shown
dmAddressNs.TabAccessible.items = dmAddressNs.CheckboxArray;
// dmAddressNs.CheckboxArray is correctly filled here
// and can set other properties of dmAddressNs.TabAccessible

evant
7 Jun 2008, 2:04 AM
http://extjs.com/deploy/dev/docs/?class=Ext.Panel&member=add

hobbes
7 Jun 2008, 2:21 AM
http://extjs.com/deploy/dev/docs/?class=Ext.Panel&member=add

Thank you, evant!
This leads us to


for (var i = 0; i < dmAddressNs.CheckboxArray.length; i++) {
dmAddressNs.TabAccessible.add(dmAddressNs.CheckboxArray[i]);
}

dmAddressNs.TabAccessible.doLayout();


which works perfectly.
Greetings, Dirk