Categories | Question details Back To List | ||
Corresponding JSON for the XML i am currently using XML as the input , and i want it to be replaced by an JSON Please do run the below code i wanna same out put passing an json instead of XML. So what are the changes i should make in the code and how to make the json sample.xml <?xml version="1.0"?> <rows> <head> <column width="220" align="left" type="tree">Category</column> <column width="25" align="center" type="ro">*</column> <column width="24" align="center" type="ro">0-1</column> <column width="24" align="center" type="ro">2</column> <settings> <colwidth>px</colwidth> </settings> </head> <row id="Business/Services"> <cell image="folder.gif">Business/Services</cell> <cell style="background-color:#336633;color:#336633;">1</cell> <cell style="background-color:#336633;color:#336633;">1</cell> <cell style="background-color:#336633;color:#336633;">1</cell> <row id="1"> <cell>Stock Trading</cell> <cell style="background-color:#336633;color:#336633;">1</cell> <cell style="background-color:#336633;color:#336633;">1</cell> <cell style="background-color:#336633;color:#336633;">1</cell> </row> <row id="2"> <cell>Job Search</cell> <cell style="background-color:#336633;color:#336633;">1</cell> <cell style="background-color:#336633;color:#336633;">1</cell> <cell style="background-color:#336633;color:#336633;">1</cell> </row> <row id="3"> <cell>Finance/Banking</cell> <cell style="background-color:#336633;color:#336633;">1</cell> <cell style="background-color:#336633;color:#336633;">1</cell> <cell style="background-color:#336633;color:#336633;">1</cell> </row> <row id="4"> <cell>Business</cell> <cell style="background-color:#336633;color:#336633;">1</cell> <cell style="background-color:#336633;color:#336633;">1</cell> <cell style="background-color:#336633;color:#336633;">1</cell> </row> </row> </rows> example.html <html> <head> <title>Loading from JSON</title> <link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxgrid.css"> <script src="../../codebase/dhtmlxcommon.js"></script> <script src="../../codebase/dhtmlxgrid.js"></script> <script src="../../codebase/dhtmlxgridcell.js"></script> <script src="../../codebase/dhtmlxtreegrid.js"></script> </head> <body> <link rel='STYLESHEET' type='text/css' href='../common/style.css'> <div id="gridbox" width="500px" height="250px" style="background-color:white;overflow:hidden"></div> <script> gridbox = new dhtmlXGridObject('gridbox'); gridbox.imgURL = "../../codebase/imgs/"; gridbox.setSkin("XP"); gridbox.enableAutoHeight(true); gridbox.enableAutoWidth(true); gridbox.init(); gridbox.loadXML("sample.xml"); </script> </body> </html> Answer posted by Support on Jun 25, 2008 02:02 >>Please do run the below code
>>i wanna same out put passing an json instead of XML. There is no way to achieve the same effect with JSON. In current version JSON can't be used for loading grid configuration, only for data loading. |