Actually, I’m trying to load native JSON data into a dhtmlxGrid, but in vain.
Knowing that I’ve followed the instruction from the link below docs.dhtmlx.com/grid__data_forma … jsonformat
Here is the error I got:
Uncaught TypeError: undefined is not a function dhtmlx.js:9
window.dhx4.ajax._call dhtmlx.js:9
window.dhx4.ajax.get dhtmlx.js:9
dhtmlXGridObject.load dhtmlx.js:9
dhtmlXGridObject.load dhtmlx.js:9
doOnLoad gridJSON.html:28
onload gridJSON.html:32
You can find attached an example for those who want to reproduce the problem.
Can you please take a look ? see If someone has already faced this issue.
I add some details to better explain the problem.
The code that causes the problem is this:
var data = {“total_count”:50000, “pos”:0, “data”:[
{ “col1”: “A Time to Kill”,
“col2”: “John Grisham”,
“col3”: “100”
},
{ “col1”: “Blood and Smoke”,
“col2”: “Stephen King”,
“col3”: “1000”
},
{ “col1”: “The Rainmaker”,
“col2”: “John Grisham”,
“col3”: “-200”
}
]};
var myGrid;
function doOnLoad(){
myGrid = new dhtmlXGridObject(‘gridbox’);
myGrid.setColumnIds(“col1,col2,col3”);
myGrid.load(data,“js”);
}
The error obtained when the example is deployed on a web server is
Uncaught TypeError: undefined is not a function dhtmlx.js:9
window.dhx4.ajax._call dhtmlx.js:9
window.dhx4.ajax.get dhtmlx.js:9
dhtmlXGridObject.load dhtmlx.js:9
dhtmlXGridObject.load dhtmlx.js:9
doOnLoad gridJSON.html:28
onload gridJSON.html:32
The error obtained by opening the page directly through the browser
TypeError: c.indexOf is not a function
…1)}}}if(a==“GET”&&this.cache!=true){c+=(c.indexOf("?")>=0?"&":"?")+“dhxr”+new Da…
Following the example I’ve seen and test, parse method work only with Basic JSON format, like this :
data={
rows:[
{ id:1, data: [“A Time to Kill”, “John Grisham”, “100”]},
{ id:2, data: [“Blood and Smoke”, “Stephen King”, “1000”]},
{ id:3, data: [“The Rainmaker”, “John Grisham”, “-200”]}
]
};
And my need is to use Native JSON format like this :
data= {“total_count”:50000, “pos”:0, “data”:[
{ “col1”: “A Time to Kill”,
“col2”: “John Grisham”,
“col3”: “100”
},
{ “col1”: “Blood and Smoke”,
“col2”: “Stephen King”,
“col3”: “1000”
},
{ “col1”: “The Rainmaker”,
“col2”: “John Grisham”,
“col3”: “-200”
}
]};
Is someone can give me an example of a GRID with Native JSON format?