We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Is there a way to not render command buttons for certain rows in a TreeGrid.

Thread ID:

Created:

Updated:

Platform:

Replies:

144984 May 30,2019 04:17 PM UTC May 31,2019 11:28 AM UTC jQuery 1
loading
Tags: ejTreeGrid
John Anderson
Asked On May 30, 2019 04:17 PM UTC

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?

Manivannan Padmanaban [Syncfusion]
Replied On May 31, 2019 11:28 AM UTC

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. 




CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon