Is there a way to set the state of the TreeList Select All checkbox?

1 Answer 35 Views
TreeList
Evan
Top achievements
Rank 1
Evan asked on 08 Jan 2025, 11:13 PM

Setting the initial TreeList selection, or clearing it programmatically, does not seem to update the Select All checkbox.  Is there a way to programmatically do it?
I am using row selection as described in these pages:

https://www.telerik.com/kendo-angular-ui/components/treelist/selection/row-selection#select-all-checkbox

https://www.telerik.com/kendo-angular-ui/components/treelist/selection/persisting#persisting-row-selection-based-on-a-specific-field

Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Zornitsa
Telerik team
answered on 13 Jan 2025, 01:15 PM

Hi Evan,

Indeed, you are correct that the select-all checkbox of the TreeList does not update its state accordingly when the selected rows are set programmatically. After further examining the described scenario, it turns out that this behavior is a bug on our side, which is why I logged the following item in our public GitHub repository:

For now, I would suggest subscribing to the above bug report in order to stay notified in a timely manner with any updates on the future fix implementation for this bug.

As a small token of gratitude for reporting this unexpected behavior and helping us improve the quality of our product, I have updated the Telerik points of your account.

In the meantime, what I can suggest as a possible approach for controlling the state of the select-all checkbox according to the currently selected rows when they are programmatically set is to implement a header template with a custom CheckBox for the <kendo-treelist-checkbox-column> component. In that way, you can use the checkedState property and the checkedStateChange event of the CheckBox component to synchronize its value depending on the selected items programmatically:

<kendo-treelist-checkbox-column [width]="80">
      <ng-template kendoTreeListHeaderTemplate>
          <kendo-checkbox
            [checkedState]="checkedState"
            (checkedStateChange)="onChange()"
          ></kendo-checkbox>
      </ng-template>
</kendo-treelist-checkbox-column>

In this line of thought, we apologize for any inconvenience that the mentioned bug might have caused on your side. 

I hope the provided information is helpful.

Regards,
Zornitsa
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Evan
Top achievements
Rank 1
commented on 13 Jan 2025, 11:26 PM

Thanks, I will see what I can do following your suggestion.

Evan
Tags
TreeList
Asked by
Evan
Top achievements
Rank 1
Answers by
Zornitsa
Telerik team
Share this question
or