This is a migrated thread and some comments may be shown as answers.

Virtual Scrolling With kendoGridCellTemplate Checkbox

2 Answers 404 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Scott Michetti
Top achievements
Rank 1
Iron
Scott Michetti asked on 19 Sep 2019, 08:11 PM

Hello,

I am using virtual scrolling with a kendoGridCellTemplate that has a checkbox in it. If I check some of the boxes and scroll, the pageChange event fires and I grab new data. The new checkboxes are showing checked. They should not be checked. How do I make sure the data is correct when virtual scrolling? I was looking here PersistingTheSelection thinking I should be able to do something similar to keep track of my selections but I could not figure it out. Here is a simple example of my cell template.

 

<ng-template kendoGridCellTemplate>
          <input type="checkbox">       
</ng-template>

Thanks,

Scott

2 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 24 Sep 2019, 07:37 AM

Hello Scott,

Thank you for your patience!

I would recommend binding the checkboxes' checked property to an expression that returns true if the row's ID exists in the selection array. For example: 

            <kendo-grid-column title="Selected" [width]="40">
              <ng-template kendoGridCellTemplate let-dataItem>
                <input type="checkbox" [checked]="mySelection.indexOf(dataItem.ProductID) >= 0">   
              </ng-template>
            </kendo-grid-column>

Please, let me know if have further questions.

Regards,
Alexander Popov
Progress Telerik

Get quickly onboarded and successful with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Scott Michetti
Top achievements
Rank 1
Iron
answered on 27 Sep 2019, 03:40 PM
Thank you for the reply.
Tags
Grid
Asked by
Scott Michetti
Top achievements
Rank 1
Iron
Answers by
Alexander Popov
Telerik team
Scott Michetti
Top achievements
Rank 1
Iron
Share this question
or