PDA

View Full Version : Re-rendering ".add"ed components



jbrooksuk
3 Feb 2011, 8:52 AM
Hey,

Currently I'm adding a new card to a Panel by using:

c = nestedContacts.add({
height: 150,
width: 300,
itemId: id,
html: rec.get('phone'),
dockedItems: [{
xtype: 'toolbar',
dock: 'top',
items: [{
text: 'Back',
ui: 'back',
handler: function() {
nestedContacts.setActiveItem(0, { type: 'slide', reverse: true });
}
}]
}]
});
However once it's added, the parent item (a floating panel) moves, but once the List item is clicked and rendered, the behaviour does not occur anymore.

How can I force the layout as soon as the components are added?

I've tried:


added: function() {
// c.doLayout();
// c.doComponentLayout();
}
But I get errors. (without comments of course)

James

jbrooksuk
4 Feb 2011, 3:17 AM
Fixed.

I basically create a new Panel inside of its parent and add:

renderTo: nestedContacts.el.dom.childNodes[0].id
Works a treat.