Selects drop-down list item and sets the value and the text of the combobox

1 posts, 0 answers
  1. Marius
    Marius avatar
    2 posts
    Member since:
    Aug 2012

    Posted 29 Aug 2012 Link to this post

    Hi

    I have a grid and a 5 kendoComboBox combobox on a form
    When the user selects an item from the grid, I am setting the value of  kendo Combobox based on the values that were in the grid row.

    i tried

    // selects item if its text is equal to "test" using predicate function
    combobox.select(function(dataItem) {
        return dataItem.text === "test";
    });
    with no result
    here is my code
            var urlcountry = '@Url.Action("GetGeoGroupCountry", "GeoGroupPostalCode")';
            $.ajax({
                url: urlcountry,

                success: function (result) {
                    debugger;

                    var countryCombo = $("#GeoGroupCountryId").data("kendoComboBox");
                    countryCombo.dataSource.add(result);

                    countryCombo.select(function (dataItem) {
                        //dataItem argument is a ComboBox data item.
                        return dataItem.Text === e.sender.dataSource._data[0].GeoGroupCountryName;
                    });
    // e.sender.dataSource._data[0].GeoGroupCountryName) is 'United States of America'

    The same no result

    //                $.each(countryCombo.dataSource._data, function (key, value) {
    //                    if (value.Text == e.sender.dataSource._data[0].GeoGroupCountryName) {
    //                        countryCombo.select(key);
    //                       return;
    //                    }
    //                });

                },
    Thanks
Back to Top