简体   繁体   中英

Filtering with the Kendo UI ComboBox in the ASP.NET MVC on array of numbers

I have a problem to use filtering in the Kendo UI ComboBox with the list of integers. I use list of integers as a DataSource , Filter of type StartsWith and ServerFiltering(false) .

@(Html.Kendo().ComboBox().Placeholder("Jahr")
      .IgnoreCase(true)
      .Name("planungsZeiten")
      .Filter(FilterType.StartsWith)
      .DataSource(source => source.Read(read => read.Action("GetPlanungsZeiten", "Reweco"))
                                  .ServerFiltering(false)))

public JsonResult GetPlanungsZeiten()
{
    using (var repo = new ANECON_PDATAEntities())
    {
        return Json(repo.PlanungsZeiten.Select(j => j.Jahr).OrderByDescending(j => j).ToList(), JsonRequestBehavior.AllowGet);
    }
}

As I type in the ComboBox , JavaScript exception is thrown:

Object doesn't support property or method 'toLowerCase'

在此处输入图片说明

在此处输入图片说明

This happens because the type number don't support the method toLower .

The version I using is 2013.1.514 but the same behavior is on latest version 2014 Q1 SP1 (2014.1.416) as you can see here: http://jsfiddle.net/akalcik/Fv8S5/1/

I already tried to set .IgnoreCase(true) but it make no difference. Do I something wrong or is it the bug?

Startwith is not a valid filter for integer type. You should either use integer filters (equal, greater than, etc.), or change the type of your underlying source integer field to string to apply string filters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM