我想显示一个带有详细模板的kendo网格,所有细节行都处于开放位置。
我正在使用服务器绑定,因此可能有用的详细模板的许多事件不会发射。
我尝试使用htmltableattributes,但这似乎也不起作用。
从IE F12分析中,网格带有带有无显示的详细模板表,然后在按下打开图标时删除显示状态。
我有一个客户,他希望所有详细的模板处于开放位置。
这是我的Kendo代码:
@(Html.Kendo().Grid(Model)
.Name("PriorityListingGrid1")
.Columns(columns =>
{
columns.Bound(e => e.name).Title("Immunotherapy Open Studies").HeaderHtmlAttributes(new { style = "font-size:x-large;font-weight:bold;text-align:center;" })
.HtmlAttributes(new { style = "font-size:larger;font-weight:bold;text-align:left;" })
.Width("100%");
})
.Events(e => { e.DetailInit("detailInit"); })
.DetailTemplate(e => myDetailDetailViewTemplate1(this,e.siteSlotData, e.id))
.HtmlAttributes(new { style = "min-height:600px;" })
.DataSource(dataSource => dataSource
.Server()
.Model(model => model.Id(p => p.id))
.PageSize(Model.Count())
)
)
@helper myDetailDetailViewTemplate1(WebViewPage page, IEnumerable<AdminApplicationsLibrary.Immunology.SiteSlotData> f, int id, int ignored = 0)
{
String grid_ref = String.Format("details_{0}", id);
this.Page.tgrid_ref = grid_ref;
@(Html.Kendo().Grid(f)
.Name(grid_ref)
.HtmlAttributes(new { style = "width:104.3%;Left:-41px;" })
.TableHtmlAttributes(new { style = "font-size:8pt;" })
.Columns(columns =>
{
columns.Bound(o => o.RxStudy.irb).Template(@<text>
@Html.ActionLink(@item.RxStudy.irb.ToString(), "Details", "ImmunoRxStudy", new { id = @item.RxStudy.id }, null)
</text>).HeaderHtmlAttributes(new { style = "font-weight:bold;" }).Width("10%");
columns.Bound(o => o.priority).HeaderHtmlAttributes(new { style = "font-weight:bold;" }).Width("5%");
columns.Bound(o => o.RxStudy.short_name).HeaderHtmlAttributes(new { style = "font-weight:bold;" }).Width("19%");
columns.Bound(o => o.Status).HeaderHtmlAttributes(new { style = "font-weight:bold;" }).Title("Status").Width("5%");
columns.Bound(o => o.slots).HeaderHtmlAttributes(new { style = "font-weight:bold;" }).Width("8%");
columns.Bound(o => o.notes).HeaderHtmlAttributes(new { style = "font-weight:bold;" }).Width("20%");
columns.Bound(o => o.pre_tx).HeaderHtmlAttributes(new { style = "font-weight:bold;" }).Width("5%");
columns.Bound(o => o.archival).HeaderHtmlAttributes(new { style = "font-weight:bold;" }).Width("5%");
columns.Bound(o => o.on_tx).HeaderHtmlAttributes(new { style = "font-weight:bold;" }).Width("5%");
columns.Bound(o => o.RxStudy.phase).HeaderHtmlAttributes(new { style = "font-weight:bold;" }).Width("10%");
columns.Bound(o => o.RxStudy.open_date).HeaderHtmlAttributes(new { style = "font-weight:bold;" }).Width("8%");
columns.Bound(o => o.RxStudy.rn_cra).HeaderHtmlAttributes(new { style = "font-weight:bold;" }).Width("10%");
})
.DataSource(dataSource => dataSource.Server().Model(model => model.Id(p => p.id)))
)
}
使用服务器端绑定时,如何使所有详细模板的详细模板显示在所选位置中?
除非我没有其他选择,否则我真的不想使用Ajax绑定。
任何人可以帮助我吗?
大量搜索后,我发现了我要寻找的答案。
主要网格需要更改为:
@(Html.Kendo().Grid(Model)
.Name("PriorityListingGrid1")
.Columns(columns =>
{
columns.Bound(e => e.name).Title("Immunotherapy Open Studies").HeaderHtmlAttributes(new { style = "font-size:x-large;font-weight:bold;text-align:center;" })
.HtmlAttributes(new { style = "font-size:larger;font-weight:bold;text-align:left;" })
.Width("100%");
})
.DetailTemplate(e => myDetailDetailViewTemplate1(this,e.siteSlotData, e.id))
.HtmlAttributes(new { style = "min-height:600px;" })
.DataSource(dataSource => dataSource
.Server()
.Model(model => model.Id(p => p.id))
.PageSize(Model.Count())
)
.RowAction(r => { r.DetailRow.Expanded = true; })
)
RowAction方法允许此特定结果。我会注意到,我在Telerik文档或示例中找不到任何地方。我在Google和Stackoverflow上找到了对使用此问题的引用。
: - )