PDA

View Full Version : Ext.tree.Panel automatic height



Strock
5 Sep 2011, 6:45 AM
How do I create Ext.tree.Panel that automatically resizes to fit its content when nodes are expanded/collapsed?

skirtle
5 Sep 2011, 11:32 PM
This is very rarely a good idea in practice.

Here's something that works in simple cases. It won't cope with a header row and if your tree is in a container it almost certainly won't like it. I think getting it to work in the general case would be very tricky.


Ext.create('Ext.tree.Panel', {
...
listeners: {
afterrender: function() {
this.getEl().setStyle('height', 'auto');
this.body.setStyle('height', 'auto');
this.getView().getEl().setStyle('height', 'auto');
}
}
});