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

Grid popup editor. How to update field value on drop down list change

1 Answer 457 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert Smallwood
Top achievements
Rank 1
Robert Smallwood asked on 29 May 2013, 03:35 PM
I have a grid set up with my datasource and working properly with popup editing. My popup has two drop down lists and a number field. What I would like to do is set the value of the number field to a specific value when the user makes their selection from the first drop down list, essentially pre-populating the number value to "highest entered value for the user selected item + 5". 

Is there a way to hook up to the "change" event for the  drop down list in the popup editor and as part of the function for the change event, query the current dataset bound the grid to retrieve a value, then set that value to the numeric field in the popup editor?

Robert 



1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 31 May 2013, 10:53 AM
Hello,

You could use the dataSource change event to update the value e.g.

function change(e) {
    if (e.action == "itemchange" && e.field == "DropDownField") {
        var item = e.items[0];
        item.set("NumberField", item.DropDownField + 5);
    }
}
If you wish to bind to the dropdown change event then you could set the handler through the configuration if you are using custom editor or in the grid edit event if you are using a foreignkey column.

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