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

how to use model.set() with nested object

1 Answer 383 Views
Grid
This is a migrated thread and some comments may be shown as answers.
maayan
Top achievements
Rank 1
maayan asked on 26 May 2016, 03:14 PM

hi everyone

on my grid have this two fields


 <input  data-bind="value:GroupName" name="GroupName" > field on the root level of the object

 <input  data-bind="value:ThresholdsbSettings.Hold.Value" name="TransactionsHoldAllowedWarning" > nesting on the  root level of the object

i need to be able to change the model object before submit to server 

this is how i do it and it works only for the GroupName field

    var model = $("#mid_groups_grid").data("kendoGrid").dataSource.getByUid(uid);
    model.set("GroupName", null);

when i try to use this code on the nested object (TransactionsHoldAllowedWarning)

it will not change it but it will be added to the root object for some reason (look at the attached picture) 

 

any ideas how to how to use model.set with nested object

thank u

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 27 May 2016, 12:39 PM

Hello maayan,

 

I'm not sure what is the exact cause for the behavior you have described looking at the provided information. Therefore, could you please provide a small runnable sample which to demonstrate the issue you are facing.

Setting a nested object value via the set method of the ObservableObject should be done similar to the following - model.set("my.nested.object.path", 42);

 

Regards,
Rosen
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
maayan
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or