使用不同的值填充组合框并应用过滤器?

时间:2015-06-16 10:34:54

标签: javascript c# asp.net combobox kendo-combobox

这是我的控制器代码

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

这是我的控制器代码

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

        List<DefCurrencyDTO> test = DefCurrency.AllCurrency;

        return test;
    }

html代码:

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

并单击清除如何使组合框值等于空代码:

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

我想做的事情

1过滤不同的值?

1 个答案:

答案 0 :(得分:0)

替换&#34; Text&#34;使用&#34; text&#34;。

我认为代码中有一个错字:

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