我已经在 labourmeansstatusenum 列上实现了一个自定义 ui 过滤器。但是该函数没有被调用,因此过滤器没有自定义值。任何想法我做错了什么?
@(Html.Kendo().Grid<Presentation.Mvc.Models.LabourMeans.LabourMeansViewModel>()
.Name("grid")
.Columns(columns =>
{
/**/
columns.Bound(s => s.LabourMeansStatusEnum)
.ClientTemplate("# if (LabourMeansStatusEnum == 0){#" +
"<div id='outofservice'><span class='label label-info arrowed-right arrowed-in'>" + @Label.OutOfService() + "</span></div>" +
"#}else if (LabourMeansStatusEnum == 1){#" +
"<div id='intreatment'><span class='label label-info arrowed-right arrowed-in '>" + @Label.InTreatment() + "</span></div>" +
"#}else if (LabourMeansStatusEnum == 2){#" +
"<div id='inservice'><span class='label label-info arrowed-right arrowed-in '>" + @Label.InService() + "</span></div>" +
"#}#"
)
.Title("Status")
.Filterable(filterable => filterable.UI("labourMeansStatusFilter"));
.Filterable(filterable => filterable
.Extra(false)
.Operators(operators => operators
.ForString(str => str.Clear()
.IsEqualTo(@Label.IsEqualTo())
.IsNotEqualTo(@Label.IsNotEqualTo())
))
)
.Resizable(resize => resize.Columns(true))
.Pageable()
.Scrollable()
.Sortable()
.Reorderable(reorder => reorder.Columns(true))
.DataSource(dataSource => dataSource
.Ajax()
.Sort(sort => sort.Add("Id").Ascending())
.PageSize(10)
.Model(model => model.Id(s => s.LabourMeans.LabourMeans.Id))
.Read(read => read.Action("LabourMeans_Read", "LabourMeans"))
)
)
js过滤功能:
function labourMeansStatusFilter(element) {
alert("test");
element.kendoDropDownList({
dataSource: [
{ Name: "Parent1", Id: 1 },
{ Name: "Parent2", Id: 2 }
],
dataTextField: "Name",
dataValueField: "Id"
});
alert("test5");
}