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

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

0 Answers 126 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Marius
Top achievements
Rank 1
Marius asked on 29 Aug 2012, 07:44 AM
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

No answers yet. Maybe you can help?

Tags
DropDownList
Asked by
Marius
Top achievements
Rank 1
Share this question
or