Grid Dropdownlist Select Event Selected Item Text and Value Undefined

1 Answer 3445 Views
DropDownList
Fatih
Top achievements
Rank 1
Fatih asked on 12 Feb 2017, 05:33 PM

I have an inline grid, containing cascading foreign key drowdownlists with custom templates.

When selected value of one of the dropdownlist changes, I have to change the selected value of another foreign key dropdownlist within the grid.

 

I have subscribed to both Change and Select events of the source dropdownlist. Change event is working correctly. However Change event is also fired at initial load of the dropdownlist since the existing value of the foreign key is assigned to the dropdownlist. This isn't suitable for my scenario, since I want to get the event only when user manually changes the selection of the dropdownlist.

When I subscribe to Select Event, the event firing timing is exactly as I expect. It is only fired, when user manually changes the selection. However, the selected item's Text and Value properties are returned as "Undefined". I am accessing the properties as in the dropdownlist demo.

function onVehicleSelect(e) {
        if (e.item) {
            var dataItem = e.dataItem(e.item);
            console.log("event :: select (" + dataItem.Text + " : " + dataItem.Value + ")");
        }
    }

I am stuck in this problem since long time. Urgent help would be appreciated.

 

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 14 Feb 2017, 12:30 PM
Hello Fatih,

The e.dataItem will be a reference to the data item from the dataSource, so you need to access the Text or the Value properties by their corresponding names in the model. You can also use the e.item.text() method for retrieving the text. More information on the select event can be found at the following help article:

Regards,
Konstantin Dikov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
DropDownList
Asked by
Fatih
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or