View Full Version : Create a tbar-button within an ajax request

14 Oct 2010, 11:43 AM

I need to add some buttons to my tbar (grid) dynamically. due to this, i use the following code:

url: 'test.php',
params: {
"action": "getData",
success: function(response) {
var obj = Ext.decode(response.responseText);

for (day in obj.data)
if (!isNaN(parseFloat(day))) {
var btntxt = obj.data[day];
var btn = new Ext.Button({text: btntxt});

This will not work, but ...

var btn = new Ext.Button({text: "TEST"});

is working fine. Of course, the php script is delivering correct data - i checked this several times now and some other ajax requests can work with the given data fine.

What am i doing wrong ?

14 Oct 2010, 9:26 PM
After adding to a rendered Container, you must call doLayout on the Container which will then ask its layout manager to ensure all child Components are rendered, arranged and sized correctly according to the layout's type and configuration.

14 Oct 2010, 9:35 PM
Thanks !!
That was the solution.

Sone quite often - why i've forgotten that command here, no idea :o(

Thanks a lot, animal (as so often !)