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

Grid changes not reflected in datasource when using templates

5 Answers 606 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Keith
Top achievements
Rank 1
Keith asked on 12 Jul 2012, 08:15 PM
Hey,

I've recently started working with the grid component and have the need for custom templates for columns (checkboxes for booleans instead of true/false, slider for certain integer values etc).

When I set up a template for a column e.g. template: '<div style="text-align: center"><input type="checkbox" #= is_included ? checked="checked" : "" # /></div>' it displays as expected but any changes to the column are not reflected back in the datasource. 

I've seen mention of this before in the forum and was wondering if it has been fixed and I'm missing a step and if it currently is something that's missing is it going to be added at some point.

Thanks for your help

5 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 13 Jul 2012, 11:06 AM
Hi Leo,

As you may know in order to take advantage of Grid built-in editing capabilities, the particular item/cell should be set in edit mode. However, from the description you have given, I suspect that you are trying to update given model's fields while the grid is in display mode. In such case you will need to manually update the appropriate field using the DataSource API. Here is a basic implementation of such approach. 

All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Keith
Top achievements
Rank 1
answered on 13 Jul 2012, 07:29 PM
Hey Rosen, thanks a lot for replying.

As you mentioned, I am probably trying to do this in display mode (since I'm using the template property). Using your example worked as expected.

If I was to use my own column editors e.g. slider for updating a rating for instance, instead of using the display template is it possible to always have a grid in edit mode? Right now it's not obvious which columns are actually editable and once the user clicks on an editable column the change can completely change which can seem strange to a user e.g. when you click on an editable boolean column the true/false value just switches to a checkbox and a number changes to a numeric textbox etc. 

Thanks again
0
Rosen
Telerik team
answered on 16 Jul 2012, 08:02 AM
Hi Leo,

I'm afraid that having all of Grid cells in edit mode is currently not possible.

Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Quest Resource Management
Top achievements
Rank 1
answered on 16 Jan 2013, 07:18 AM
Hello All,

 I have a ForeignKey column in editable grid.
 I need to display editable dropdown control while clicking of checkbox(this is another boolean column) not clicking of foreignkey column.


Thanks,
Json
0
Jayesh Goyani
Top achievements
Rank 2
answered on 17 Jan 2013, 05:34 AM
Hello,

Please check below link for demo/code.
http://jayeshgoyani.blogspot.in/2013/01/set-column-editable-mode-based-on_16.html

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Keith
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Keith
Top achievements
Rank 1
Quest Resource Management
Top achievements
Rank 1
Jayesh Goyani
Top achievements
Rank 2
Share this question
or