如何从 Kendo Grid MVC 列定义访问 ViewModel 字段?
How do I access a ViewModel field from Kendo Grid MVC column definition?
如何访问下面的 c => c.IsExpired
字段来代替 >>> ISEXPIRED <<<
占位符?
@(Html.Kendo().Grid<Corporate.Models.OrderModel>()
.Name("ordersGrid")
.Columns(columns =>
{
columns.Template(@<text></text>)
.ClientTemplate(AdminDeleteEditTemplate().ToHtmlString())
.Visible(isAdmin)
.Width(110);
columns.Bound(c => c.OrderID)
.ClientTemplate(Html.ActionLink("#= OrderID #", "Details", "Orders", new { id = "#= OrderID #" }, new { }).ToHtmlString())
.HtmlAttributes(new { @class = "text-right" });
columns.Bound(c => c.ResellerName).ClientTemplate("#= ResellerID ? ResellerName : '' #");
columns.Bound(c => c.Date).Format("{0: MMM d, yyyy}").HtmlAttributes(new { @class = "text-right" });
columns.Bound(c => c.ExpirationDate)
.ClientTemplate("#= IsExpired == false ? kendo.toString(kendo.parseDate(ExpirationDate), 'MMM d, yyyy').concat(IsExpiringSoon ? '<small> (expiring soon)</small>' : '') : '' #")
.HtmlAttributes(new { @class = "text-right" });
columns.Bound(c => c.StringList)
.Template(@<text></text>)
.ClientTemplate("#= renderActions(data) #")
.Title("Actions")
.Visible(!Model.HideOptions);
columns.Template(@<text></text>)
.ClientTemplate(AdminOthersTemplate(>>> ISEXPIRED <<<).ToHtmlString())
.Visible(isAdmin);
})
.Events(e => e.DataBound("onOrdersDataBound"))
.Sortable()
尝试将数据对象传递给模板函数
columns.Template(@<text></text>)
.ClientTemplate("#= AdminOthersTemplate(data) #")
.Visible(isAdmin);
和
AdminOthersTemplate(data){
console.log(data.IsEscaped);
}
如何访问下面的 c => c.IsExpired
字段来代替 >>> ISEXPIRED <<<
占位符?
@(Html.Kendo().Grid<Corporate.Models.OrderModel>()
.Name("ordersGrid")
.Columns(columns =>
{
columns.Template(@<text></text>)
.ClientTemplate(AdminDeleteEditTemplate().ToHtmlString())
.Visible(isAdmin)
.Width(110);
columns.Bound(c => c.OrderID)
.ClientTemplate(Html.ActionLink("#= OrderID #", "Details", "Orders", new { id = "#= OrderID #" }, new { }).ToHtmlString())
.HtmlAttributes(new { @class = "text-right" });
columns.Bound(c => c.ResellerName).ClientTemplate("#= ResellerID ? ResellerName : '' #");
columns.Bound(c => c.Date).Format("{0: MMM d, yyyy}").HtmlAttributes(new { @class = "text-right" });
columns.Bound(c => c.ExpirationDate)
.ClientTemplate("#= IsExpired == false ? kendo.toString(kendo.parseDate(ExpirationDate), 'MMM d, yyyy').concat(IsExpiringSoon ? '<small> (expiring soon)</small>' : '') : '' #")
.HtmlAttributes(new { @class = "text-right" });
columns.Bound(c => c.StringList)
.Template(@<text></text>)
.ClientTemplate("#= renderActions(data) #")
.Title("Actions")
.Visible(!Model.HideOptions);
columns.Template(@<text></text>)
.ClientTemplate(AdminOthersTemplate(>>> ISEXPIRED <<<).ToHtmlString())
.Visible(isAdmin);
})
.Events(e => e.DataBound("onOrdersDataBound"))
.Sortable()
尝试将数据对象传递给模板函数
columns.Template(@<text></text>)
.ClientTemplate("#= AdminOthersTemplate(data) #")
.Visible(isAdmin);
和
AdminOthersTemplate(data){
console.log(data.IsEscaped);
}