I have a php page which parses an uploaded file, which I then want to load into a grid. I can achieve this by:

  1. Parsing the file into a PHP array.
  2. Writing out a valid XML file to the filesystem.
  3. Using mygrid.loadXML(“myxml.xml”) to load the file into the grid.

I would like to do this dynamically, without having to load an external file. I have not been able to get loadXMLString to work. Does anyone have such an example to share?

Instead of writing php file you can use a code similar to the next

header("Content-type:text/xml"); echo $xml_content;

and on client side


The problem I am having is that I am posting to the PHP page. So basically I need to _POST to the PHP page, generate the XML, and return it to the calling page. It is this last part that I am struggling with.

There is an optional extension for dhtmlxgrid, which adds support for grid.post command, which is similar to get, except it sends a POST request for the data

Anyway, you still can include xml directly on the page and use grid.parse to load data directly from the page ( feature requires PRO version of dhtmlxgrid )

OK. Is there some documentation or an example using the grid.post method?

Its not a part of default functionality , so it not covered by existing documentation

Basically, it can be used as

grid.post("some.php", "a=1&b=2", function(){ alert("done"); })

second parameter - list of values which will be sent by post

I went with your original suggestion and included xml directly on the page and used grid.parse to load data directly from the page. I was having problems initially because I had a carriage return embedded in my XML string. This solution works well, thanks.