Sri
Sri

Reputation: 91

How can I select the Kendo UI dropdownlist value?

How can I select the Kendo drop down list value on change function. The Kendo dropdownlist is in grid. On change function I want to select the first item in the list.

I have written the code:

       function categoryDropDownEditor(container, options) {

        var dropdownlist = $('<input data-text-field="category" id ="ctdd" data-value-field="CatId" data-bind="value:' + options.field + '"/>').appendTo(container).kendoDropDownList({
            optionLabel: "Select...",
            dataValueField: "categoryid",
            dataTextField: "category",
            autoBind: false,
            change: onChange,
            dataSource: catogory               

        }).data("kendoDropDownList");
    }

    function onChange()
             {

                   dropdownlist.select(0);
              }

But the dropdown is not selecting on change function. How can i do that please help me.

Upvotes: 1

Views: 13066

Answers (1)

user1006544
user1006544

Reputation: 1524

I think in your onchange event add e as event , e.sender.select(0) will do the trick.

here is the code.

function Change(e) {
    console.log("Event Fired"); e.sender.select(0);
    }

Upvotes: 2

Related Questions