DevelopmentIsMyPassion
DevelopmentIsMyPassion

Reputation: 3591

onblur event for kendo combobox

Is there any onblur event for kendocombobox? I read the below link but couldnt find anything. http://docs.kendoui.com/api/web/combobox

Then i tried change event like this below

 $("#selFrameworkVersion").kendoComboBox({
        change: function (e) {
            alert("I am selected");
        }
    });

This doesn't fire. I have defined my kendocombobox as below in my html

<td><input  id="selFrameworkVersion" style="width: 210px" data-bind="kendoComboBox: { dataTextField: 'Name', dataValueField: 'Id', data:  $root.versionListByProductType, value:  $root.editFrameworkVersion, optionsCaption: 'Please select Version...' }" /></td>

Data is loaded correctly. On change event or onblur event i want to perform some logic. How can i achieve it?

I call webservice and bind data to observablearray(versionListByProductType) which you can see i have used in my view

 $.ajax({
            url: "../RestService/Version/VersionListByProductType",
            type: "PUT",
            contentType: 'application/json',
            processData: false,
            data: JSON.stringify(input),
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert(errorThrown);
            },
            success: function (allData) {
                var mappedVersionListByProdType = $.map(allData, function (item) {

                    return new productVersionListByProductType(item);
                });
                self.versionListByProductType(mappedVersionListByProdType);
                callback(allData);

            }

        });

Upvotes: 0

Views: 3930

Answers (2)

NunoCarmo
NunoCarmo

Reputation: 5509

According to the documentation to attach an event after initialization you have to do something like this.

// get a reference to instance of the Kendo UI ComboBox
var combobox = $("#comboBox").data("kendoComboBox");
// bind to the change event
combobox.bind("change", function(e) {
    // handle event
});

Upvotes: 1

Petur Subev
Petur Subev

Reputation: 20203

I am not sure whats that binding which you are using? Is there such demo? Why don't you use it this way:

input  id="selFrameworkVersion" style="width: 210px" />
<script>
 $("#selFrameworkVersion").kendoComboBox({
   dataSource:["foo","bar"],
    change: function (e) {
        alert("I am selected");
    }
  });
</script>

Here is jsbin.

Upvotes: 0

Related Questions