Hello
I'm trying to show data in TreeGrid and one field must look like a checkbox.
I found two similar solution for DataGrid and try to apply it for my situation:
#1: This solution doesn't work, cell value displayed as string (true, false)
let data = $.ajax({
type: "POST",
url: "/path/to data/",
dataType: "json",
async: false,
}).responseJSON;
$('#tg').treegrid({
data: data,
idField: 'id',
treeField: 'name',
height: '100%',
columns: [[
{title: 'Name', field: 'name', width: 240},
{
title: 'Value', field: 'value', width: 50, editor: {
type: 'checkbox',
options: {
on: true,
off: false
}
}
}
]],
});
}
#2: This works, i send checked data to server-side JSON.stringify(rows), but value parameter always in false.
let data = $.ajax({
type: "POST",
url: "/path/to data/",
dataType: "json",
async: false,
}).responseJSON;
$('#tg').treegrid({
data: data,
idField: 'id',
treeField: 'name',
height: '100%',
columns: [[
{title: 'Name', field: 'name', width: 240},
{
title: 'Value', field: 'value', width: 50, formatter: function (value, row, index) {
if (value) {
return '<input type="checkbox" checked>';
}
else {
return '<input type="checkbox" >';
}
}
},
]],
});
}
And second question. How to check|uncheck needed cells in JS programmatically.
Thank you, i hope there is a simple soluthion for this
