adjustColumnSize is causing an error on load

Hello, I’m trying to call adjustColumnSize after I load the XML. Here’s my code:
mygrid.loadXML(“common/gridH.xml”);
mygrid.adjustColumnSize(“0”);

The call to adjustColumnSize causes an error.

However, if I add a button and let the user click it, the call works.

function adjustColumns() {
mygrid.adjustColumnSize(“0”);
mygrid.adjustColumnSize(“1”);
mygrid.adjustColumnSize(“2”);
mygrid.adjustColumnSize(“3”);
mygrid.adjustColumnSize(“4”);

    }

So it looks like the grid isn’t comletely loaded yet and causes an error. How can I know when it is safe to call adjustColumnSize? I need to do this on load automatically and not have the user click a button.

Thanks
Scott

Please, try to use:

mygrid.loadXML("common/gridH.xml",function(){ mygrid.adjustColumnSize("0"); });

That did it. Thanks!!