Categories | Question details Back To List | ||||||||
smart rendering and json Hello, The JSON format for the grid and the XML format for the grid are not 1-to-1 so I'm having a hard time determining what the format is for JSON and passing the POS and TOTAL_COUNT values. In XML it looks like this: <?xml version="1.0" encoding="UTF-8"?> <rows total_count="2000" pos="21"> <row id="12345"> <cell>Hello World</cell> </row> </rows> In JSON I'm guessing its something like this: $data={total_count:2000,pos:21,rows:[{id:12345,data:['Hello World']}]}; Is that correct? Answer posted by Support on Oct 21, 2008 01:28 Yes, in case of JSON, XML attributes mapped to the properties. Be sure to inlcude dhtmlxgrid_json.js file, without it - functionality will not work as expected. If necessary , we can provide PHP based sample of dyn. smart rendering loaded from JSON. Answer posted by Aran Deltac on Oct 29, 2008 11:07 OK, at first I had no clue what you were talking about because I didn't have a dhtmlxgrid_json.js file, but then a few days later 2.0 was released which does have this file. Looking at this file it appears that there is no way to set per-cell settings such as type and colspan. I would like to be able to do something like this: rows:[{id:1,data:[{colspan:6,type:"ro",content:"Something"}]}]. But, you comment "in case of JSON, XML attributes mapped to the properties" makes me think that all XML properties are available in JSON. As for your offer to create a sample PHP file - thats ok. But, what I would prefer is a document that simply and completely spells out the XML format, and a document that spells out the JSON format. There should be a one-stop place for protocol documentation rather than having to sift through mounds of documentation to find what you want like you have to now. Answer posted on Oct 30, 2008 03:31 >>that all XML properties are available in JSON. To be correct all "row" attributes mapped to related json object properties. >>But, what I would prefer is a document that simply and completely spells out the XML format http://dhtmlx.com/docs/products/docsExplorer/doc/dhtmlxxml/xmlGrid.html Answer posted by Aran Deltac on Oct 30, 2008 08:14 Great documentation about the XML format! I have no idea it existed. Thanks. :) So, JSON only supports a subset of features. Thats frustrating, as JSON is much more compact and effecient on both the client and server side. I think I'll stick with continuing to use JSON, and figure out some workaround for my particular issue. Any chance of getting cell-level configuration in to JSON? I would expect it wouldn't be too terribly complex to support an extended format where each cell may be either a simple string in the rows array, or a associative array with name/value pairs for advanced configuration. Answer posted by Support on Oct 30, 2008 11:16 >> I would expect it wouldn't be too terribly complex to support an extended format where each cell may be either a simple string in the rows array, or a associative array There is a pretty small update necessary to add such functionality. Updated dhtmlxgrid_json.js attached to the post, it may accept data as rows:[ { id:1001, data:[ "100", "A Time to Kill", {value:"12.99",title:'custom one'}, Attachments (1)
|