简体   繁体   中英

How do I add custom icons in kendo UI treeview in angular 5?

I need to add custom icons on either side of the treeview node in Kendo treeview in angular 5. I came across iconClass to add icons but could not get the syntax to add custom icons. Need a way to achieve this

You need to set the node template in order to achieve that level of customization.

Check out in the related page how component is initialized with a ng-template directive:

@Component({
    selector: 'my-app',
    template: `
    <kendo-treeview
        [nodes]="data"
        textField="text"
        kendoTreeViewExpandable

        kendoTreeViewHierarchyBinding
        childrenField="items"
        >

        <ng-template kendoTreeViewNodeTemplate let-dataItem>
            <span [ngClass]="iconClass(dataItem)"></span>
            {{dataItem.text}}
        </ng-template>

    </kendo-treeview>
  `
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM