Hello,
if i use dhtmlxGrid’s method ‘load’ from string path source grid type column render properly.
But if i use method ‘parse’ from json object of similar data - grid type column not render - i see only codes of rows of subgrid.
How i can solve this problem?
Could you please, provide a complete demo with your using problematic code, so i can suggest a proper solution.
function createGridFromJson(attachGridObject, urlToJson) {
/////Подготовка Json для формирования таблицы
var request = new XMLHttpRequest();
request.open(“GET”, urlToJson, false);
request.send(null);
var my_JSON_object = JSON.parse(request.responseText);
////
try {
var myGrid = attachGridObject.attachGrid();
} catch (err) {
alert(attachGridObject + ": Этот объект не может присоединять таблицу!");
}
//// цикл по колонкам с типом grid
var parent = document.getElementsByTagName(‘BODY’)[0];
var elem = document.createElement(“div”);
parent.appendChild(elem);
elem.id = uuidv4();
elem.style = "width:500px; height:350px; z-index: 500";
var subgrid = new dhtmlXGridObject(elem.id);
subgrid.init();
myGrid.setSubGrid(subgrid, 1, 0);
function loadsubend() {
subgrid.setStyle(
"border-right: 1px solid lightgray;",
"border-right: 1px solid lightgray;",
"",
""
);
}
subgrid.load("assets/dhtmlxSuite/samples/dhtmlxGrid/common/custom.json", loadsubend, "js");
////////////////////////////
myGrid.setImagePath("assets/dhtmlxSuite/codebase/imgs/");
myGrid.setStyle(
"border-right: 1px solid lightgray;",
"border-right: 1px solid lightgray;",
"",
""
);
myGrid.enableMarkedCells();
myGrid.enableColumnMove(true);
myGrid.init();
myGrid.parse(my_JSON_object, loadend, "js");//после трансформации, но не работает отрисовка зависимых таблиц
return myGrid;
}
Strangely enough, but I have solved a problem…
All properly work if use similar load method for grid and subgrid - ‘load’ and ‘load’ or ‘parse’ and ‘parse’ respectively)