New to Kendo UI for jQuery? Download free 30-day trial

Making Parent Nodes Font Bold in a TreeView

Environment

Property Value
Product Progress® Kendo UI® TreeView for ASP.NET MVC
Version 2023.2.606

Description

I want to make the parent nodes font bold in a TreeView using Progress Kendo UI for ASP.NET MVC.

Solution

To achieve the desired behavior, follow these steps:

  1. Add the following code to the document.ready scope:
$(document).ready(function () {
    var allGroups = $("[aria-expanded]");

    for (var i = 0; i < allGroups.length; i++) {
        var currDivItem = $(allGroups[i]).find("div").eq(0);

        $(currDivItem).css("font-weight", "bold");
    }
});

This code selects all nodes with aria labels, retrieves the first div element of each parent node, and changes its CSS to make the font bold.

Now, when the TreeView is rendered, the parent nodes will have bold font.

Notes

  • Make sure to include the jQuery library in your project for this approach to work.
  • You can customize the font weight by modifying the value in the css method.
In this article