<div id="assetsGrid" data-bind="ejTreeGrid: { dataSource: assets, idMapping: 'Id', parentIdMapping: 'ParentId', selectedRowIndex: selectedAssetGridRow, enableVirtualization: true, isResponsive: true, enableResize: true, rowHeight: 48, enableCollapseAll: false, columns: [{ field: 'Code', headerText: 'Code', width: 200, verticalAlignment: 'center' }, { field: 'Description', headerText: 'Description' }, { field: 'WrcName', headerText: 'Wrc' }, { field: 'MaterialCode', headerText: 'Material Code' }, { field: 'ExternalMaterialCode', headerText: 'Ext Material Code' }, { headerText: 'Docs', isTemplateColumn: true, templateID: 'viewDocsColumnTemplate', textAlign: 'center', width: 50 } ], toolbarSettings: { showToolbar: true, toolbarItems: [ ej.TreeGrid.ToolbarItems.Add, ej.TreeGrid.ToolbarItems.Edit, ej.TreeGrid.ToolbarItems.Delete, ej.TreeGrid.ToolbarItems.ExpandAll, ej.TreeGrid.ToolbarItems.CollapseAll ] }, editSettings: { allowEditing: true, allowDeleting: true }, toolbarClick: toolbarClick, rowDataBound: assetRowDataBound }"> </div>
[HTML]
<div id="TreeGrid" data-bind="ejTreeGrid:{ expandStateMapping:'isExpand' ... }" style="width:100%;height:450px;">
//..
</div>
var sampleData = [
{
taskID: 1, ... ,subtasks: [ ... ]
},
{
taskID: 6, ... ,isExpand: false,subtasks: [ ... ]
},
//..
]; |