I'm using a dropdowntree editor on a grid column. The bound field is a list of objects.
- How would I prevent the top-level from getting selected when using check boxes with CheckAll true? I only want the second level items.
- Conversely, how would I select the top level if any of the second level items are checked?
Ex. I would not want 18' checked here, just the two children on the 2nd level:
Editor:
function equipmentEditor(container, options) {
let ds = new kendo.data.HierarchicalDataSource({
data: _equipmentTypes,
schema: {
model: {
children: "Items"
},
},
});
$("<input data-bind='value: EquipmentTypes'/>")
.attr("name", options.field)
.appendTo(container)
.kendoDropDownTree({
checkboxes: {
checkChildren: true
},
checkAll: true,
autoWidth: true,
dataTextField: "Description",
dataValueField: "Code",
dataSource: ds,
autoClose: false,
tagMode: "single",
});
_equipmentTypes data used in dataSource:
[{
"Code": "17'",
"Description": "17'",
"Items": [
{
"Code": "T17.DUMP",
"Description": "17' Dump Trailer",
"Items": []
}
]
},
{
"Code": "18'",
"Description": "18'",
"Items": [
{
"Code": "T18.FLAT",
"Description": "18' Flatbed Trailer",
"Items": []
},
{
"Code": "T18.TANK",
"Description": "18' FoodGrade Tank Trailer",
"Items": []
}
]
}
]
Posted object:
"EquipmentTypes": [
{
"Code": "17'",
"Description": "17'",
"Items": [
{
"Code": "T17.DUMP",
"Description": "17' Dump Trailer",
"Items": [],
"id": "",
"index": 0,
"checked": true,
"_level": 1,
"_tagUid": "b13353ee-cbd3-4226-8b4c-080d4ea775e4"
}
],
"index": 0,
"expanded": true,
"checked": true,
"_level": 0,
"_tagUid": "c0785273-c8bd-4a18-8598-de5d7ba6c16e"
},
{
"Code": "T17.DUMP",
"Description": "17' Dump Trailer",
"Items": [],
"id": "",
"index": 0,
"checked": true,
"_level": 1,
"_tagUid": "b13353ee-cbd3-4226-8b4c-080d4ea775e4"
}
],