Populate Combo Box with distinct values and apply filter?

614 views Asked by At

here is my code to controller

    var products = new kendo.data.DataSource({
            batch: true,
            transport: {
                read: {
                    type: "GET",
                    dataType: "json",
                    contentType: "application/json; charset=utf-8",
                    url: "/api/Companies/GetAllCompanies",
                }
            }
        })

here is my controller code

     [HttpGet]
    public List<DefCurrencyDTO> GetAllCompanies()
    {

        List<DefCurrencyDTO> test = DefCurrency.AllCurrency;

        return test;
    }

html code:

  <input id="products" style="width: 300px" data-bind="value: CurrentCurrencyCode "/>

and on click clear how to make combobox value equal to null code:

  document.getElementById('products').value = null;

things i want to do

1-filter distinct values?

1

There are 1 answers

2
Vishal Suthar On

Replace "Text" with the "text".

I think there is a Typo in the code:

$("#products").kendoDropDownList({     
    dataTextField: "Text",   <---------------- Here you wrote "Text" instead of "text"
    dataValueField: "value",
    filterable: true,
    filter: "contains",
    dataSource: products
});