……………..
let grid: TreeGrid = new TreeGrid(
{
dataSource: sampleData,
childMapping: 'subtasks',
treeColumnIndex: 1,
height: 400,
………………………
columns: [
{
field: 'taskID', headerText: 'Task ID', isPrimaryKey: true, textAlign: 'Right',
validationRules: { required: true, number: true }, width: 80
},
{ field: 'taskName', headerText: 'Task Name', edit:
{
create: function() {
elem = document.createElement("input");
return elem;
},
read: () => {
return multiSelectObj.value;
},
destroy: () => {
multiSelectObj.destroy();
},
write: args => {
multiSelectObj = new MultiSelect({
dataSource: <{key: string, value: any}[]>grid.grid.dataSource,
fields: { value: 'taskName' },
value: Array.isArray(args.rowData["taskName"])? args.rowData["taskName"] : [args.rowData["taskName"]],
});
multiSelectObj.appendTo(elem);
}
},
width: 200 },
{
field: 'priority', headerText: 'Priority', width: 90,
}
]
});
grid.appendTo('#Grid');
|