I bought dhtmlx and am using dhtmlXGridObject to make a page which lists out the historical records from input forms. In my gridObject, it should lists out rows of data and some of them have subrow for related record. I would like to ask how to add sub_row or sub_row_grid in JSON format?
Here is my code:
gridObj = new dhtmlXGridObject(id);
gridObj.setHeader( , A, B, C, D, E);
gridObj.attachHeader( , #text_filter, #text_filter, #text_filter, #text_filter, #text_filter);
gridObj.setColAlign(center, center, center, center, center, center);
gridObj.setColTypes(sub_row, ed, ed, ed, ed, ed, ed);
gridObj.setColSorting(na, str, str, str, str, str);
gridObj.enableAutoWidth(true);
gridObj.enableAutoHeight(true);
gridObj.init();
griddata = { “rows”: [
{id: 1, data: [SUBROW, a1, b1, c1, d1, e1]},
{id: 2, data: [SUBROW, a2, b2, c2, d2, e2]}
]};
gridObj.parse(griddata, “json”);
What should I input in SUBROW so that I can show the sub records when I click the ‘plus’ icon?
I want to show the records by this way:
A | B | C | D | E
- a1 | b1 | c1 | d1 | e1
sub_a1 | sub_b1 | sub_c1 | sub_d1 | sub_e1 - a2 | b2 | c2 | d2 | e2
sub_a2 | sub_b2 | sub_c2 | sub_d2 | sub_e2
sub2_a2 | sub2_b2 | sub2_c2 | sub2_d2 | sub2_e2
- a3 | b3 | c3 | d3 | e3