2

I am using Primeng v13.4.1 I am using p-tree component to display hierarchy options with checkbox. when a child node is selected the parent node is not selected. this issue happens only when i add scrollHeight, virtualScroll and virtualNodeHeight

<p-tree
            #tree
            [value]="nodes"
            selectionMode="checkbox"
            [propagateSelectionUp]="true"
            [propagateSelectionDown]="true"
            (onNodeUnselect)="onNodeUnselect()"
            (onNodeSelect)="onNodeSelect()"
            disabled="disabled || readonly"
            [scrollHeight]="_config.scrollHeight"
            [virtualScroll]="_config.virtualScroll"
            [virtualNodeHeight]="_config.virtualNodeHeight"
        ></p-tree>
    

if i dont use the scrollHeight, virtualScroll and virtualNodeHeight, then it displays correctly

the generated elements are different on selecting a node

without height set:

<div class="p-checkbox p-component ng-star-inserted" ng-reflect-ng-class="[object Object]" aria-checked="false">
    <div class="p-checkbox-box p-indeterminate" ng-reflect-ng-class="[object Object]">
        <span class="p-checkbox-icon pi pi-minus" ng-reflect-ng-class="[object Object]"></span>
    </div>
</div>

with height and other virtual scroll set:

<div class="p-checkbox p-component ng-star-inserted" ng-reflect-ng-class="[object Object]" aria-checked="false">
    <div class="p-checkbox-box" ng-reflect-ng-class="[object Object]">
        <span class="p-checkbox-icon" ng-reflect-ng-class="[object Object]"></span>
    </div>
</div>

Aslo when height properties set, it creates <cdk-virtual-scroll-viewport> wrapper for the tree.

Mukil Deepthi
  • 6,072
  • 13
  • 71
  • 156
  • Yes, You're right! on adding attributes virtualScroll, virtualNodeHeight and scrollHeight it is giving `parent: undefined` in selected items [(selection)]. For now, it could be better to use without virtualScroll and using this component on web worker. – Sachin Chillal Feb 13 '23 at 06:54

0 Answers0