JSON format

At the bottom of this page:
docs.dhtmlx.com/doku.php?id=dhtm … at_details

It has an example of the JSON format, but the example doesn’t work. It says that you can set the cell type by making one of the data values an object and setting a type property. I used the exact json listed there, and in my grid I see
1000 Blood and Smoke [object Object]

It seems like the json parse doesn’t recognize an object with a value property and/or a type property. You need to fix your json documentation. I would like an example that works for setting the cell style and cell type on a particular cell.

Try this:

{
    "total_count":50000,
    "pos":0,
    "rows":[{
            "id":1002,
            "selected":true,
            "style":"color:red;",
            "userdata":{
                "name1":"ud1",
                "name2":"ud2"
            },
            "data":["1000",
                "Blood and Smoke",
                {
                    "value":"Stephen King",
                    "type":"ed"
                }
            ]
        }
    ]
}

I am not sure I see what is different in your json, but I copied it into my app and it does the same thing. The third column displays as

[object Object]

I am using
dhtmlxGrid v.3.0 Standard edition build 110707

Do I have to have the professional edition to get this to work? I don’t see anything that says that.

It’s important that I understand for my evaluation whether it is possible to specify editor type (and style) on each cell of the grid using json. I can’t make it work using the standard edition and the example provided.

Can someone please confirm if it does not work, or if I need the professional version? If it does work, can I set a css style/type for the cell within the json?

Is any support out there? I am not going to buy the grid if it doesn’t do what I want, and if I can’t get answers to simple questions.

Hello? Do you want to sell your product? Just answer my question for why the json example in your documentation does not work.

Try:

mygrid.clearAndLoad({url}, "json");

or post your code

I’m not using a url. I am using the json specified in the documentation at the url in my first post. I’m basically saying the documentation doesn’t work, and nobody seems to care to explain why.

 var data = { total_count: 50000,
                         pos: 0,
                         rows: [
                           { id: 1002,
                           selected: true, // select row
                           style: "color:red;", // assign style
                           userdata: { "name1": "ud1", "name2": "ud2" }, //setting row userdata
                           data: [
                          "1000",
                          "Blood and Smoke",
                          { "value": "Stephen King", "type": "ed" }, //change cell type
                          ]
                       }
                ]
                            };


            mygrid = new dhtmlXGridObject('mygrid_container');
            mygrid.setImagePath("scripts/dhtmlxGrid/imgs/");
            mygrid.setHeader("sales, title, author");
            mygrid.setColAlign("right,left,left");
            mygrid.setColTypes("ro,ro,ro");
            
            mygrid.init();
            mygrid.setSkin("modern");
            
            mygrid.parse(data, "json");

This code causes [object Object] to be displayed in the third cell. It is not editable. The row does not display in red. Basically, it doesn’t seem to load any of the properties specified.

Hello.

PLease, make sure that you have added dhtmlxgrid_json.js library to your code.
You can find it in “dhtmlxgrid/codebase/ext” directory.

Does that file only exist in the professional edition? I downloaded the standard edition, and I don’t see that file.

The documentation doesn’t say that (full featured) json loading is only available in the professional edition.

Does dhtmlxgrid_json.js only exist in the professional edition? I downloaded the standard edition, and I don’t see that file.

The documentation doesn’t say that (full featured) json loading is only available in the professional edition.

Your JSON struct is still wrong. Please check it on
jsonlint.com/

Or see here
dhtmlx.com/docs/products/dht … _text.html
how to declare a correct JSON struct in JavaScript

My json was not wrong. It was fine. As soon as I got the json js file, which only seems to come in the professional version, it worked.

The documentation should state that the json in the example won’t work with the standard version.

Yes, the biggest problem is the documentation. :frowning:

Hi,

Did you get any response for this? I’m experiencing the same problem.

Thanks!

Unfortunately dhtmlxgrid_json.js file is included in PRO version only.
The mistake in the documentation will be corrected.

Took me 4 hours to find this information. Is it documented anywhere?

Unfortunately the required file is available only in PRO version of dhtmlxGrid.