Hi John,
Thanks for contacting Syncfusion Support. We are happy to assist you.
Query: If I configure a tree grid column to use Command Buttons, is there a way to configure it so the buttons only show up for Parent rows, child rows, or some combination of them based on the data source?
From the above query, we are able to understand that you want to show the command buttons only for the parent rows. Here, we have showed the command button only for the rows which is having child records using queryCellInfo event of TreeGrid. Kindly refer the below code example,
<script type="text/javascript">
var onclick = function (args) {
alert("hit"); // do your stuff here
}
var onQueryCellInfo = function (args) {
if (!args.data.hasChildRecords) {
if (args.cell.classList.contains("e-unboundcell")) {
args.cell.querySelector('.e-unboundcelldiv').style.display = "none"
}
}
}
let grid: TreeGrid = new TreeGrid(
{
……………………………
queryCellInfo: onQueryCellInfo,
columns: [
{
……………..
{
headerText: 'Custom Button', width: 100,
commands: [
{ buttonOption: { content: ' Details', click: onclick } }]
}
]
});
grid.appendTo('#Grid');
|
Regards,
Manivannan Padmanaban.