GRID: Model not updating if dataItem is editable
1 Answer 12 Views
Luca
Top achievements
Rank 1
Luca asked on 14 Jul 2021, 06:01 PM

Hello,

I'm having a problem updating the model in a Grid Editing with kendo AngularJS.

It looks like the model updates if the field in the schema is set to editable: false but it does not update when is editable: true

here is a DEMO with both inline and popup editing.

When selecting Detroit from the City, the Country should change to USA. It does not do that when the field Country has editable: true, but if you change that to editable: false the page works. The goal here is to have USA selected by default by still give the user the ability to change the Country manually.

https://dojo.telerik.com/usIWIyIS

Is there any way to make this work?

1 Answer, 1 is accepted

Sort by
0
Georgi Denchev
Telerik team
answered on 19 Jul 2021, 09:46 AM

Hi, Luca,

Thank you for the provided dojo and details.

The recommended approach to modifying the underlying model programmatically, is to use the model.set() method, instead of directly assigning the value:

//$scope.editor.Country = e.dataItem.Country;
$scope.editor.set("Country", e.dataItem.Country);

Applying the above change should take care of the issue and allow you to update the value without setting "editable" to false.

Updated dojo:

https://dojo.telerik.com/@gdenchev/AdIjIqek 

Let me know if you have any questions.

Best Regards,
Georgi Denchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Luca
Top achievements
Rank 1
commented on 19 Jul 2021, 04:21 PM

Hello Georgi,

Thank you so much for your support!
I forgot about the set method. This works just fine.

Thanks
Luca
Asked by
Luca
Top achievements
Rank 1
Answers by
Georgi Denchev
Telerik team
Share this question
or