Trouble during grid initialization

this.Grid = this.ListaLayout.items[0].attachGrid(); this.Grid.setImagePath(imagePath); /* Struttura */ this.Grid.load("xml/" + this.Name + "_grid.xml"); this.Grid.attachEvent("onRowDblClicked", function(rId,cInd) { this.MyForm.load("php/connector/" + this.Name + "form.php?id=" + this.cells(rId,0).getValue()); this.MyTabbar.setTabActive("dati"); } ); this.Grid.init(); <--- here the problem this.Grid.load("php/connector/" + this.Name + ".php");

I’m trying to load the grid struct dinamically, then init the grid and after load the data in the grid. if i run the program in firebug everything works fine but not in normal run.
The problem is the init() call because it’s starts before the loading of the xml with the structure.

Have any idea?

This not an issue. init() method allwasy called before loading data.
If you need re-load grid structure, you should use following code:


Please find example here … eload.html

You don’t understand my problem. I want to do this:

  1. load only structure from an xml
  2. init the grid
  3. load only data from connector with php (that fit the structure at point 1)

It’s possible?

If you init grid structure from xml, you may not call init() method.
load() method works in asynchronous way, so next command will be called event if first is not finished yet. Work around is following:

MyGrid.load("xml/structure.xml",function(){ MyGrid.load("php/connector.php"); });

I’ve tried to do in your way but the function was never called.

MyGrid.load("xml/structure.xml",function(){ alert("ok"); });


The xml is properly loaded everytime.



string value



Check the attached sample. (112 KB)

Thank you! Now our grid is correct initialized and populated but after all pop out a blank alert box and firebug trace a js error:

This is the code:

[code]this.Grid = this.ListaLayout.items[0].attachGrid();
/* Struttura */

this.Grid.methodName = function(value)
									this.load("php/connector/" + value + "_grid.php");
	this.Grid.attachEvent("onRowDblClicked", function(rId,cInd)
						this.MyForm.load("php/connector/" + this.MyName + "_form.php?id=" + this.cells(rId,0).getValue());
	this.Grid.load("xml/" + this.Name + "_grid.xml");[/code]

this is the structure xml


#text_filter,#text_filter,#text_filter id codice descrizione dhx_skyblue imballi [/code]

this is the data xml

<?xml version='1.0' encoding='utf-8' ?><rows><row id='1'><cell><![CDATA[1]]></cell><cell><![CDATA[NYL]]></cell><cell><![CDATA[PACKAGE NYLON]]></cell></row><row id='55'><cell><![CDATA[55]]></cell><cell><![CDATA[NIL]]></cell><cell><![CDATA[PACCO IMBALLO NYLON]]></cell></row></rows>

tag is not closed in the configuration xml, which leads to xml parsing error.

The xml is correct. Try to slide the scroolbar!

Try to slide the scroolbar!
Yep, it was a dumb mistake from my side :blush:

The “docObj is null” error can appear if xml object is broken somehow
Try to modify your code as

this.Grid.methodName = function(value){ var grid = this; window.setTimeout(function(){ grid.load("php/connector/" + value + "_grid.php"); },1); };
It will ensure, that second xml will start loading only after existing one will be fully processed.

Thank you!!! Now it works in a great way! :mrgreen: