loadXML delay in XtreeGrid object

Hi,



I have an XTreeGrid that I’m trying to populate and then straightaway want to call a function to interrogate the contents of the grid to determine a value. So my grid is edittable and I call loadXML and init as follows:



        edittable.loadXML(loadUrl, determineCatchAll());

        edittable.init();



The grid loads ok based on the XML I give in the “loadUrl” variable, but the determineCatchAll function seems to be called before the grid is containing anything. The function calls getAllRowIds() and this always returns an empty list. I do see the grid get populated but this seems to be delayed and happens after my function has run. I’m doing this as part of the onLoad() call as the page initialises.



If I call the determineCatchAll() function via a button on my webpage it works ok - it’s just getting called before the grid contains anything. I’ve even tried calling determineCatchAll() after the edittable.init() but again the timing seems out.



Is this a known problem - is there anyway to get round this - or am I doing something wrong :slight_smile: ?



I’m using pro version v1.6



Many thanks for any help or guidance.

The correct syntax is

        edittable.init(); 

        edittable.loadXML(loadUrl, determineCatchAll); 
// there is no brackets after function name

When you write function with brackets - it is executed instantly, if you provide only function name - it will be executed after data loaded in grid

Ah, that works - thank you very much for the speedy reply!