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

Passing / reading a value on the dropdown list

1 Answer 10 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 17 Mar 2017, 09:22 PM

I have a simple dropdown list that I'm attaching a viewModel to though the observable method.

<input class="span-full" data-role="dropdownlist" id="DROPDOWNONE" data-bind="events: {open: getProps }, value: '+ __cols[n].name +' ">

I'm binding it to an open function like so: 

getProps: function(e){
        console.log("who am i?");
}

What I want to do is when a user opens the menu with their mouse is to have the value of the id passed to it. Like so.

getProps: function(e){

        // Code I'm missing goes here.
        // var id = grabsomething.fromsomeplace();
       console.log(id); // Outputs DROPDOWNONE
}

Please help. Thanks

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 21 Mar 2017, 02:16 PM
Hello Philip,

In the DropDownList's open event handler you can access the the widget's id like this: e.sender.element.attr("id");

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