When loading a grid via XML, we can define column headers and other grid attributes with the following syntax:
string value
string value
Header1
Header2
Header3
…
Is this supported with json-based loading? If so, what’s the syntax for the JSON equivalent to this?
Unfortunately JSON format doesn’t support grid header. If you load grid via JSON format you should set grid’s header via API: mygrid.setHeader(); mygrid.setInitWidths();
Thanks for the reply… is this feature planned for a future release? We’re moving our codebase to json-based rendering, but a significant portion of it uses dynamic headers. I’d hate to have to move all that logic to the JS side.
Unfortunately, this feature won’t be implemented in the next release.
So, you can initialize grid (set its header) from xml and load rows from json:
mygrid = new dhtmlXGridObject(‘gridbox’);
…
mygrid.load(“header.xml”,function(){
mygrid.load(“data.json”,“json”);
})
Where header.xml is:
string value
string value
Header1
Header2
Header3
…
This doesn’t work.