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

[Solved] will not bind a checkbox column in the grid

4 Answers 543 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Peter Beyer
Top achievements
Rank 1
Peter Beyer asked on 27 Jan 2015, 09:51 AM
Dear Telerik,

We have problems implementing binding to a checkbox in a grid. We believe that we do everything the Kendo way, but it's still not working.

We have made an example were you can see our problem - may be someone in here can see, what we are doing wrong.

What you should do to see the problem: try check one or many items in the select column. Push the button "Show selected items". We have made a alert, that will display the id's that we have selected, but the alert is empty, even that we have bind the column.

Example

http://dojo.telerik.com/AYaTE


Thanks in advance


Peter Beyer
CRM-Byggefakta

4 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 29 Jan 2015, 07:48 AM
Hello Peter,

This happens because no binding is performed over the templates. There are a couple of ways to achieve the desired behavior:
  • Use the dataBound event handler to get all items in the current view, find the corresponding checkboxes by the row's data-uid attribute and manually bind them
  • Use a click event handler instead of binding, then manually set the value of the dataItem corresponding to the row

I would also recommend checking this example, illustrating similar behavior.

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
Peter Beyer
Top achievements
Rank 1
answered on 29 Jan 2015, 03:14 PM
Thank you Alexander,

It helps us a little bit, but we still have some issues.

Checked rows doesn’t stay checked
after grouping by columns. And filtering is spinning sometimes.

Try this example, and see the attached pictures :
http://dojo.telerik.com/ozAdu

thanks Peter





0
Alexander Popov
Telerik team
answered on 02 Feb 2015, 09:49 AM
Hi Peter,

The filtering issue occurs because the data type of the fields is not defined in the DataSource's schema.model. Persisting the selection when using grouping could also be achieved, however a slightly different approach should be used. Basically, the "view" contains grouped data, so the selected items cannot be found in that collection. I would suggest using the Grid's dataItems method instead, as shown here.

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
Peter Beyer
Top achievements
Rank 1
answered on 03 Feb 2015, 10:51 AM
Hi Alexander,

I just talk with my developer, and he says that your implementation suggestion is working fine.

Thank you

Regards


Peter
Tags
Grid
Asked by
Peter Beyer
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Peter Beyer
Top achievements
Rank 1
Share this question
or