Setting layout with XML & getting data in MySQL : possible ?


I setup a dataConnector to link a grid with my MySQL database : it is working fine.

As my code is hugly (many columns setup, etc.) I wished , as I do for the forms with loadStruct() function, to load the grid header configuration from an XML file.

I am not successfull in loading the grid structure in the XML and then, get data from the database through the data processor. It seems that both way to function are exclusive:
a) basic state : columsn are setup using Javascript, load of data from the PHP connector and setup of dataprocessor : columns and content are displayed
a) load the XML (with only the section, no row data content defined) and setup the dataprocessor: columns are displayed, but not filled in with data
b) load of XML file, load of the PHP connector and setup of dataprocessor : columns are not even displayed

Is there a way to do what I want:

  1. load grid structure (header configuration) from an XML file
  2. then, load and work with data using a Connector linked to my mySQL database


You may load structure and data of the grid separately:

mygrid.loadXML("structure.xml", function(){ mygrid.loadXML("data.xml", function(){ }) });

structure.xml in this case will contain only the “header” part :

<?xml version="1.0" encoding="UTF-8"?> <rows> <head> <column width="50" type="dyn" align="right" sort="str">Sales</column> <column width="150" type="ed" align="left" sort="str">Book Title</column> <column width="100" type="ed" align="left" sort="str">Author</column> <settings> <colwidth>px</colwidth> </settings> </head> </rows>

data.xml - contains a data of the grid:

<?xml version="1.0" encoding="UTF-8"?> <rows> <row id="1"> <cell>-1500</cell> <cell>hghghgjg</cell> <cell>3213</cell> </row> <row id="2"> <cell>1000</cell> <cell>Blood and Smoke</cell> <cell>stephen King</cell> </row> ...


Will the same work with structure from XML followed by a load from php that get data from database ?

Loadxml() followed by load() did not work during my tests but i was not using the function() callback… Maybe the trick was here ?



juste a quick feedback to confirm that it works ! Thanks !

Everything was behind the callback use :slight_smile:

Thanks !