|
import { TreeGrid, DetailRow , IRow, CommandColumn} from '@syncfusion/ej2-treegrid';
……………
// import the CommandColumn feature
TreeGrid.Inject(DetailRow,CommandColumn); // inject the CommandColumn feature
let onClick = (args: Event) => {
let row: any = (<HTMLTableRowElement>closest(args.target as Element, '.e-row')).nextSibling; // get the details row.
if (row.style.display == "none") {
row.style.display = ""; // Show/hide the details row.
} else {
row.style.display = "none";
}
}
var onDetailDataBound = function(args) {
args.detailElement.parentElement.style.display = "none"; // hide the details row.
}
let treegrid: TreeGrid = new TreeGrid(
{
………………………………..
detailDataBound: onDetailDataBound,
width: 'auto',
columns: [
………………………………………
{ headerText: 'Row Details', textAlign:'Left', width: 120,
commands: [{ buttonOption: { content:"Details RowInfo", click: onClick } }]},
]
});
treegrid.appendTo('#TreeGrid');
|