Spoorti
Spoorti

Reputation: 3

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

Upvotes: 0

Views: 1385

Answers (1)

DontVoteMeDown
DontVoteMeDown

Reputation: 21465

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>
  `
})

Upvotes: 1

Related Questions