我正在使用启用了可过滤选项的DateTime列。在日期列中,仅Isequalto过滤器无法在服务器中运行,但在localhost中可以正常运行。我不知道此问题的路由原因。下面的示例代码
@( Html.Kendo().Grid<Assignments>()
.Name("Grid")
.BindTo((IEnumerable<Assignments>)Model)
.Columns(columns =>
{
columns.Bound(p => p.UserId).Title("Number").Width(140).EditorTemplateName("GetUserIDAutoComplete")
.HeaderHtmlAttributes(new { style = "white-space: normal" });
columns.Bound(p => p.DateDeployed).Title("Date Deployed").Width(140)
.Format("{0:MM/dd/yyyy}").EditorTemplateName("Datepicker").Width(160)
.HeaderHtmlAttributes(new { style = "white-space: normal" });
})
.Events(e => e.DataBinding("GridDataBound"))
.Editable(editable => editable.Mode(GridEditMode.InLine).CreateAt(GridInsertRowPosition.Top))
.Events(events => events.Edit("onEdit"))
//.Events(events => events.Save("onSave"))
.Pageable(page => page.Refresh(true).PageSizes(new int[] { 10, 25, 50, 75, 100 }))
.Sortable()
.Scrollable(scr => scr.Height(430))
.ColumnMenu()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.PageSize(10)
//Sort by SerialNumber by default
.Sort(a => a.Add("UserId").Ascending())
.ServerOperation(false)
.Model(model =>
{
model.Id(p => p.UserId);
model.Field(p => p.DateDeployed).Editable(true);
})
.Create(create => create.Action("Create", "Assignments", new { id = "#=UserId#" }))
.Read(read => read.Action("Read", "Assignments"))
.Update(update => update.Action("Update", "Assignments").Data("UpdateStat"))
.Events(events => events.RequestStart("CheckAccess"))
.Events(events => events.RequestEnd("OnRequestEnd_Grid"))
)
)
班级
public class Assignments
{
[Required]
public string UserId { get; set; }
[Required]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
public DateTime? DateDeployed { get; set; }
}