Reputation: 1491
Have a question about changing anchor property dynamically...
I have some FormPanel, which contains one textfield, one panel and one textarea
for textarea I set "anchor : 100% -somevalue". Panel is added dynamically(when needed), so I want to change anchor property for textarea depending on whether Panel is added.
Upvotes: 0
Views: 2345
Reputation: 16150
Use doLayout()
. Example:
var p = Ext.create('Ext.panel.Panel', {
renderTo: Ext.getBody(),
width: '100%',
height: 200,
layout: 'anchor',
items:[{
title:'Item 1',
html:'100% 20%',
anchor:'100% 20%'
},{
title:'Item 2',
html:'50% 30%',
anchor:'50% 30%'
},{
title:'Item 3',
html:'-100 50%',
anchor:'-100 50%'
}]
});
setTimeout(function(){
p.items.items[0].anchor = '89% 20%';
p.doLayout();
}, 2000);
Working sample: http://jsfiddle.net/lolo/uN2w9/1/
Upvotes: 1