PrimeNg TreeTable. Default selected rows

52 views Asked by At

Could you please help me to understand how we can select/highlight rows in the tree table by default?

TreeNode interface does not have something related to the highlight row.

Thanks

Input: a default list of IDs of nodes that need to be selected/highlighted by default

<p-treeTable [(selection)]="selectedNodes"...></p-treeTable>

For now, I just try to update selectedNodes (for the selection property of pTreeTable) by searching in a tree (recursively). But I don't like this because, for large datasets, it is an expensive operation).

1

There are 1 answers

3
Balkishan Dhaker On

You can pass the a value for which items you need to highlight. and access in the rowData and add some class to row element to highlight. You can check the documentation for conditional style: https://primeng.org/treetable#conditionalstyle