![](/img/trans.png)
[英]Kendo TabStrip with KendoGrid inside using JavaScript for Events handling
[英]Nested KendoGrid with Kendo Tabstrip error
我在網格內有一個網格。 第二個網格與面板內的選項卡共享。 一切正常,直到我包括Tabstrip代碼為止。 我在chrome控制台中收到的錯誤是這樣的:
Uncaught Error: Invalid template:
我的查看代碼:
@(Html.Kendo().Grid<MVC.Models.Msg>()
.Name("MsgGrid")
.Events(e => e.DataBound("LineItems_Databound"))
.Columns(columns =>
{
//.ClientTemplate("#= LineItems_Databound(Status)#")
columns.Bound(p => p.ID).Width(50).Hidden(true).HtmlAttributes(new { @class = "Refreshpage" });
columns.Bound(p => p.Company).Title(@"<span tabindex=5>Company</span>").Width(75);
columns.Bound(p => p.Type).Title(@"<span tabindex=5>Type</span>").Width(75);
})
.Pageable(pager => pager.Messages(Info => Info.Empty("No Results Found")))
.Filterable()
.Sortable()
.ClientDetailTemplateId("messagetemplate")
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(6)
.Read(read => read.Action("PaginationGrid", "Controller"))
)
)
<script id="messagetemplate" type="text/kendo-tmpl">
<div class="col-md-6">
@(Html.Kendo().Grid<MVC.Models.MsgDetails>()
.Name("msgid_#=ID#")
.Columns(columns =>
{
columns.Bound(e => e.Type).Width("35%").Filterable(filterable => filterable.Extra(false).Operators(ops => ops.ForString(str => str.Clear().Contains("Contains")))).Encoded(false);
columns.Bound(e => e.Description).Width("35%").Filterable(filterable => filterable.Extra(false).Operators(ops => ops.ForString(str => str.Clear().Contains("Contains")))).Encoded(false);
columns.Bound(e => e.DetailsDate).Width("30%").Format("{0: dd/MM/yyyy HH:mm:ss}").Filterable(filterable => filterable.Extra(false).Operators(ops => ops.ForString(str => str.Clear().Contains("Contains")))).Encoded(false);
})
.HtmlAttributes(new { style = "overflow-y: hidden;" })
.Pageable(pager => pager.Messages(Info => Info.Empty("No Results Found")))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Read(read => read.Action("DetailPaginationGrid", "Controller", new { MsgID = "#=ID#" }))
)
.Filterable()
.Pageable()
.Sortable(sortable => sortable.AllowUnsort(false))
.ToClientTemplate()
)
</div>
<div class="col-md-6 panel panel-primary">
<div class="panel-heading">
<h2>Messages</h2>
<hr />
</div>
<div class="k-content">
@(Html.Kendo().TabStrip()
.Name("messageStrip")
.Items(tabstrip =>
{
tabstrip.Add()
.Text("msg1")
.Selected(true)
.Encoded(false)
.ContentHtmlAttributes(new { style = "overflow: auto;" })
.Content(@<text>
<div id="message1" class="panel-body">
#=message1#
</div>
</text>);
tabstrip.Add()
.Text("msg2")
.Encoded(false)
.ContentHtmlAttributes(new { style = "overflow: auto;" })
.Content(@<text>
<div id="message2" class="panel-body">
#=message2#
</div>
</text>);
})
)
</div>
</div>
</script>
我的問題是,此選項卡如何使它成為無效模板? 我需要在哪里進行更改...謝謝
您需要將.ToClientTemplate()
添加到.ToClientTemplate()
,就像您將其添加到網格中一樣
@(Html.Kendo().TabStrip()
...
.ToClientTemplate())
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.