View Full Version : Restoring automatic height e.g. to a text fields attached to dom

17 Jul 2012, 2:11 AM

I have components such as textfields that I for different reasons have to have in a non Ext container such as a normal div. Then I set width and height using setWidth / setHeight, which works fine but I cannot seem to reset it later to the automatic sizing it had before I changed the size.

Is there no way to make the textbox height for example be "wrap content" so to say?

Also I have understood that there is no way to make individual components just adjust to a non Ext container width without alot of wireing. I have it working but wonder if anyone else solved this in a nicer way for Ext 4.1.

Thanks for any pointer you can throw at me.

24 Jul 2012, 1:12 PM
I am not sure I understand your question.
For tracking resize events, you can use the EventManager:

Ext.EventManager.onWindowResize(mycontainer.doLayout, mycontainer);


25 Jul 2012, 4:53 AM
Well resizing the components on resize I have solved like you, by listening for resize events. But the first issue was a bit different, like this:
1. Create a button (mybutton) and render to a dom.
2. Wish that the button was really big and cool
3. set height by mybutton.setHeight(1337); // now the button is really cool
4. change your mind about that height and wish that it was the default size again.
5. ?
6. Profit! The button is now as small as all the rest again.

Cheers, J