0
필터링 된 데이터를 표에 표시하고 싶지만 정확히 왜 그 이유가 정확히 month.earfilter where 절 뒤에 표시되지 않는지 알 수 없습니다. 데이터를 검도 표에 바인딩합니다. currentmonthyear를 사용하지만 monthYearfilter는 사용하지 않습니다. 나는 다른 프로젝트에서 이전에 동일한 기능을 사용했고 잘 돌아갑니다.Kendo의 DataSourceResult 표시 후 linq을 사용하는 where 절
linq where 절 다음에 DataSourceResult 결과의 데이터를 가져 오지만 표에 표시되지 않습니다.
// 컨트롤러 코드
[HttpPost]
public ActionResult BillingChecklist_Read([DataSourceRequest]DataSourceRequest request,string monthYearfilter)
{
using (var preemploymentdata = new AREntities())
{
IQueryable<BillingCheckList> preEmploymentWorkflows = preemploymentdata.BillingCheckLists;
DataSourceResult result;
if (monthYearfilter != null)
{
result = preEmploymentWorkflows.Where(x => x.MonthYear == monthYearfilter).ToDataSourceResult(request);
}
else
{
string currentmonthyear = DateTime.Now.Year + "/0" + DateTime.Now.Month;
result = preEmploymentWorkflows.Where(x => x.MonthYear == currentmonthyear).ToDataSourceResult(request);
}
return Json(result);
}
}
// 코드보기 당신이 인에서 데이터를 방지하기 위해 DataSourceResult을 반환하기 전에 필터를 삭제하려고 데이터 서버 측 필터링되기 때문에
@{
Html.Kendo().Grid<BillingCheckList>()
.Name("MyGrid")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("BillingChecklist_Read", "BillingChecklist"))
.Model(model => model.Id(p => p.OfficePrefix))
)
.Columns(col =>
{
col.Bound(o =>.OfficePrefix).Groupable(false).Title("Offices");
col.Bound(o => o.MonthYear).Title("MonthYear").Visible(false);
col.Group(group => group
.Title("Time Entered & Completed").HeaderHtmlAttributes(new { style = "text-align:center" })
.Columns(info =>
{
info.Bound(o => o.IsTimeWk1).HeaderHtmlAttributes(new { style = "text-align:center" }).HtmlAttributes(new { style = "text-align:left" })
.ClientTemplate("<input type='checkbox' #= IsTimeWk1 ? checked='checked': '' # onclick='UpdateCheckBox(#= BilingChecklistID #, \"#= OfficePrefix #\", \"#= 'IsTimeWk1'#\", \"#= IsTimeWk1 #\" )'/>")
.Title("WK<br>1").Width(5);
info.Bound(o => o.IsTimeWk2).HeaderHtmlAttributes(new { style = "text-align:center" }).HtmlAttributes(new { style = "text-align:left" })
.ClientTemplate("<input type='checkbox' #= IsTimeWk2 ? checked='checked': '' # onclick='UpdateCheckBox(#= BilingChecklistID #, \"#= OfficePrefix #\", \"#= 'IsTimeWk2'#\", \"#= IsTimeWk2 #\" )' />")
.Title("WK<br>2").Width(5);
info.Bound(o => o.IsTimeWk3).HeaderHtmlAttributes(new { style = "text-align:center" }).HtmlAttributes(new { style = "text-align:left" })
.ClientTemplate("<input type='checkbox' #= IsTimeWk3 ? checked='checked': '' # onclick='UpdateCheckBox(#= BilingChecklistID #, \"#= OfficePrefix #\", \"#= 'IsTimeWk3'#\", \"#= IsTimeWk3 #\" )'/>")
.Title("WK<br>3").Width(5);
info.Bound(o => o.IsTimeWk4).HeaderHtmlAttributes(new { style = "text-align:center" }).HtmlAttributes(new { style = "text-align:left" })
.ClientTemplate("<input type='checkbox' #= IsTimeWk4 ? checked='checked': '' # onclick='UpdateCheckBox(#= BilingChecklistID #, \"#= OfficePrefix #\", \"#= 'IsTimeWk4'#\", \"#= IsTimeWk4 #\" )'/>")
.Title("WK<br>4").Width(5);
info.Bound(o => o.IsTimeWk5).HeaderHtmlAttributes(new { style = "text-align:center" }).HtmlAttributes(new { style = "text-align:left" })
.ClientTemplate("<input type='checkbox' #= IsTimeWk5 ? checked='checked': '' # onclick='UpdateCheckBox(#= BilingChecklistID #, \"#= OfficePrefix #\", \"#= 'IsTimeWk5'#\", \"#= IsTimeWk5 #\" )'/>")
.Title("WK<br>5").Width(5);
}));
}) .Sortable()
.Render();
}