We are evaluating this product for use on our company and being new to this I have one issue so far. That is dynamically creating a grid based on data from the DB. Our application is a Java based application that returns a JSON object to the front end. Our JSON object is correct as it has this format:
etc… That could have many more records in that format. The columns are the numbers and the rows for each column would be the letters.
We need to be able to create the grid dynamically, including the colunmns.
When we try to create a Grid passing a JSON format as above, we get a java script error that says “data.rows is undefined”. Is that really a requirement? That for a JSON format we need to modify the JSON object to look somethins like I show below:
Do we have to add in the words “rows” and “id” and “data” to get this to work? Or is there a way around this?
Any help will be greatly appreciated.
Do we have to add in the words “rows” and “id” and “data” to get this to work?
Yes, you have to add words “rows”, “id” and “data” to get it work.
Or is there a way around this?
You can create custom JSON format. Please find tutorial here docs.dhtmlx.com/doku.php?id=dhtm … _loading&s=custom&s=xml#custom_loading_types_creation
Note, each row in grid must have unique id.
Can I have some more examples of JSON formats?
I’m not understanding clearly how we can use a more generics JSON format from a database to fill a grid.
My idea is to have something more generic such as
as that can easily be dumped from our database and the view can be tinkered from the select… (all other config is done from the gfrid itself, obviously)… but i dont need to do any id management outside of the array or anything… I can also just send the entire DB return field-set to the JSON encoder, without needing even to re-parse it…
any ideas about something of the sort?
(I’m also having some issues with grid.parse(myJsonVariable,“json”) using the evaluation copy as i’m getting that a.rows error… I e-mailed sergey about it…
Can you double-check if datagrid supports jsondataconnector?
I couldnt get it to work initially… I tried again, but from memory the json looking like i said, no id, rows, separate, id was together with each row…
Try to use latest version of dhtmlxConnectors dhtmlx.com/x/download/regula … or_php.zip