New to Telerik UI for ASP.NET Core? Download free 30-day trial

Custom Commands

You can implement custom commands for handling the records of the TreeList.

To include a command column which will render a button for triggering the command in the column cells:

  1. Add a custom command column by using the column definition.

        .Columns(columns =>
        {
            columns.Add().Width(300).Command(c =>
            {
                c.Custom().Name("details").Text("View Details").Click("showDetails");
            });
        })
    
        <kendo-treelist name="treelist">
            <columns>
                <treelist-column>
                    <commands>
                        <treelist-column-command name="details" text="View Details" click="showDetails"></treelist-column-command>
                    </commands>
                </treelist-column>
            </columns>
            <!-- Other configuration. -->
        </kendo-treelist>
    
  2. Wire the click event of the button to a JavaScript function which will receive the corresponding TreeList data item as an argument. In the function definition, handle the command.

    <script type="text/javascript">
        function showDetails(e) {
            alert("Custom command button clicked!");
        }
    </script>
    

See Also

In this article