Help me layout json file load

I want to layout load it from a local file.

I can’t tell what to do.

Please teach me the way.

var grid = new dhx.Grid(null, " C:\Users\home\Downloads\grid.json "); <----

I don’t believe DHX will load that data for you anymore, like it did in older versions. You have to first get the data into a JSON object variable first, then create the grid using that variable. To load the data dynamically, use the AJAX methods to load the data, then create the grid in the promise that the ajax method returns. Something like this:

var grid;
dhx.ajax.get("C:\Users\home\Downloads\grid.json").then(function(data){
    grid = new dhx.Grid(null,data);
}).catch(function(error){
    console.log(error);
});

The catch() is not required, but I tend to find it helpful for troubleshooting when things go wrong.

1 Like

kcasarez is right.

It is not available to load the grid cionfig from a local file. You should use the ajax request to load the config onyour page (note, that a local path is not available in this case, you need to configure the web server) and parse the config data to your dhx.Grid object.