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

Assigning values from one datasource to another

2 Answers 66 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
JCSCo
Top achievements
Rank 1
JCSCo asked on 19 Aug 2014, 07:43 PM
Hi,
I have a page that has three different datasources bound to a host of grids, text boxes, drop downs, etc. All three datasources are being saved at the same time via a single button that fires the sync event for all three datasources. I need to update a field in one of the grids with a calculated value from a different grid (bound to a different datasource) WITHOUT calling the sync function sending updates to the server. I can successfully retrieve the value from the source grid in the change event, but I am not sure how to assign that value to the field in the other datasource. Any ideas?

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Popov
Telerik team
answered on 21 Aug 2014, 11:43 AM
Hello JCSCo,

This could be achieved by getting the data item you wish to modify and use its set method. For example: 
var item = dataSource1.at(1);
item.set("FieldToBeUpdated", dataSource2.at(1).FieldToGetValueFrom);

In case you wish to updated this field for all items, then you could iterate over the array returned by the DataSource's data method and use the above approach.

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
JCSCo
Top achievements
Rank 1
answered on 21 Aug 2014, 04:38 PM
Thanks, that seems to do the trick.
Tags
Data Source
Asked by
JCSCo
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
JCSCo
Top achievements
Rank 1
Share this question
or