将 Kendo.Grid 中的过滤器更改为使用文本而不是关联的绑定值 w/Column
Change the Filter in Kendo.Grid to Use Text instead of Bound Value associated w/Column
在我的 Kendo.Grid 我有:
columns.Bound(c => c.FORMRIGHTTYPEID).Width("25").Title("Form Right").HtmlAttributes(new { @class = "text-align: center;" })
.Template(@<text>
@if (item.FORMRIGHTTYPEID != null)
{
@DisplayRight((long)item.FORMRIGHTTYPEID)
}
</text>);
请注意,我显示的是与 w/the FORMRIGHTTYPEID 数值关联的文本值。我制作了网格 "Filterable":
@(Html.Kendo().Grid<EPIMS.Models.FORMRIGHTS>()
...
...
.Scrollable()
.Groupable()
.Sortable()
.Filterable(filterable => filterable
.Extra(false)
.Operators(operators => operators
.ForString(str => str.Clear()
.Contains("Contains")
)))
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.BindTo(Model))
我的问题是过滤器选项显示 "Show items with value that: Is equal to" 但不允许我输入文本。相反(正如预期的那样),值必须是数字,因为该列绑定到数值字段。
是否可以自定义过滤器?
谢谢
实现了一个存储过程,该过程returns ID 和 DESCRIPTION 字段关联 w/the 数值。基本上,@mmillican 建议做什么(即更改视图模型)。
在我的 Kendo.Grid 我有:
columns.Bound(c => c.FORMRIGHTTYPEID).Width("25").Title("Form Right").HtmlAttributes(new { @class = "text-align: center;" })
.Template(@<text>
@if (item.FORMRIGHTTYPEID != null)
{
@DisplayRight((long)item.FORMRIGHTTYPEID)
}
</text>);
请注意,我显示的是与 w/the FORMRIGHTTYPEID 数值关联的文本值。我制作了网格 "Filterable":
@(Html.Kendo().Grid<EPIMS.Models.FORMRIGHTS>()
...
...
.Scrollable()
.Groupable()
.Sortable()
.Filterable(filterable => filterable
.Extra(false)
.Operators(operators => operators
.ForString(str => str.Clear()
.Contains("Contains")
)))
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.BindTo(Model))
我的问题是过滤器选项显示 "Show items with value that: Is equal to" 但不允许我输入文本。相反(正如预期的那样),值必须是数字,因为该列绑定到数值字段。
是否可以自定义过滤器?
谢谢
实现了一个存储过程,该过程returns ID 和 DESCRIPTION 字段关联 w/the 数值。基本上,@mmillican 建议做什么(即更改视图模型)。