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

How to implement Grid with checkbox column and virtualization?

3 Answers 304 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andriy
Top achievements
Rank 1
Andriy asked on 14 Nov 2014, 11:18 AM
Hi there,

I would like to implement grid with virtualization and one column with checkboxes. Each checkbox should display it's 'checked/unchecked' states when scrolling among pages.

Thanks in advance,

Andrii Frankiv

3 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 18 Nov 2014, 09:42 AM
Hello,

This could be achieved by storing the selected items in an array, then restoring the selection when the Grid's dataBound event gets triggered. For example:

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Andriy
Top achievements
Rank 1
answered on 27 Nov 2014, 09:57 AM
Hello Alexander,

Thanks a lot for your reply, but have can implement this using MVVM pattern? The idea is that inside viewmodels I'm not allowed to access DOM elements and modify their state.

F.E. the code below is not recommended to be implemented inside viewmodel.
this.tbody.find("tr[data-uid='" + view[i].uid + "']")
            .addClass("k-state-selected")
            .find(".checkbox")
            .attr("checked","checked");

Regards,
Andrii Frankiv

0
Alexander Popov
Telerik team
answered on 01 Dec 2014, 08:52 AM
Hello Andrii,

This could be achieved by adding a boolean field to the model and binding the checkboxes to it using the checked binding. Then, once the Grid's DataBound event is triggered you can check the value of the boolean field and decide whether to call the select method.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Andriy
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Andriy
Top achievements
Rank 1
Share this question
or