Grid Dropdownlist Select Event Selected Item Text and Value Undefined

2 posts, 0 answers
  1. Fatih
    Fatih avatar
    1 posts
    Member since:
    Jan 2017

    Posted 12 Feb Link to this post

    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.

     

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2053 posts

    Posted 14 Feb Link to this post

    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.
Back to Top