繁体   English   中英

在数字数组上使用ASP.NET MVC中的Kendo UI ComboBox进行过滤

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

我在Kendo UI ComboBox中使用带有整数列表的过滤时遇到问题。 我将整数列表用作数据源StartsWithServerFiltering(false)类型的Filter。

@(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);
    }
}

当我在ComboBox中键入内容时,会引发JavaScript异常:

对象不支持属性或方法“ toLowerCase”

在此处输入图片说明

在此处输入图片说明

发生这种情况是因为类型编号不支持toLower方法。

我使用的版本是2013.1.514,但最新版本2014 Q1 SP1(2014.1.416)的行为相同,如此处所示: http : //jsfiddle.net/akalcik/Fv8S5/1/

我已经尝试设置.IgnoreCase(true),但没有区别。 我有什么问题还是错误?

Startwith不是有效的整数类型过滤器。 您应该使用整数过滤器(等于,大于等),或者将基础源整数字段的类型更改为string以应用字符串过滤器。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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