Jquery 剑道层次网格中的访问Id值
我有一个用ClientDetailTemplate定义的Hierarchical网格,如下所示Jquery 剑道层次网格中的访问Id值,jquery,asp.net-mvc,kendo-ui,kendo-grid,Jquery,Asp.net Mvc,Kendo Ui,Kendo Grid,我有一个用ClientDetailTemplate定义的Hierarchical网格,如下所示 @(Html.Kendo().Grid(Model.NotesList) //Bind the grid to NotesList .Name("activityNotesGrid") .Columns(columns => { // Create a column bound to the Date property
@(Html.Kendo().Grid(Model.NotesList) //Bind the grid to NotesList
.Name("activityNotesGrid")
.Columns(columns =>
{
// Create a column bound to the Date property
columns
.Bound(n => n.Date)
.Title("DATE")
.Format("{0:MM/dd/yyyy}");
// Create a column bound to the Author property
columns
.Bound(n => n.Author)
.Title("ADDED BY");
})
.Filterable()
.Sortable()
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(true)
)
.Events(events => events.DataBound("grid_dataBound"))
.ClientDetailTemplateId("threadedNotesTemplate")
)
<script id="threadedNotesTemplate" type="text/kendo-tmpl" class=".k-grid-header">
@(Html.Kendo().Grid<ActivityThreadedNoteModel>()
.Name("grid_#=NoteId#")
//.Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
.Columns(columns =>
{
//columns
// .Bound(p => p.RegistryId)
// .Title("RegistryId");
//columns
// .Bound(p => p.RegistryDisplayName)
// .Title("Registry");
columns
.Bound(p => p.Date)
.Format("{0:MM/dd/yyyy}");
//.Title("Care Guideline");
columns
.Bound(p => p.Author);
columns
.Bound(p => p.NoteType);
//.Title("Process Status");
//.Title("Outcome Status");
columns
.Bound(p => p.Note);
columns
.Bound(p => p.NoteDetailsId)
.ClientTemplate(
"# if (ShowInOverview == true) { #" +
"<i><a href='" + Url.Action(Constants.Actions.Show_HideInOverview_Note, Constants.Controllers.PatientActivity) + "?**NoteDetailsId**= #=item.NoteDetailsId #&showInOverview=false'" + ">" + Medventive.Registry.UI.Web.Resources.RegistryMVCWeb.HideInOverview + "</a></i>" +
"# } else { #" +
"<i><a href='" + Url.Action(Constants.Actions.Show_HideInOverview_Note, Constants.Controllers.PatientActivity) + "?NoteDetailsId= #=item.NoteDetailsId #&showInOverview=true'" + ">" + Medventive.Registry.UI.Web.Resources.RegistryMVCWeb.HideInOverview + "</a></i>" +
"# } #"
);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Read(read => read.Action(Constants.Actions.LoadPatientThreadedNotes, Constants.Controllers.PatientActivity, new { NoteId = "#=NoteId#" }))
)
.Pageable()
.Sortable()
.ToClientTemplate()
)
</script>
在运行时,我得到一个javascript错误,item.NoteDetailsId未定义。我需要将Id传递给操作/控制器。我的视图模型中确实包含NoteDetailsId属性,并且它在模型中确实有一个值
我是剑道新手,希望能在这里得到任何帮助 有趣的是,对于剑道层次网格,它尝试在通过ajax调用从服务器获取值之前渲染网格 通过在ajax调用中将id值传递给子网格,在呈现它们时隐藏它们,并在单击子项的相应链接时使用kendo grid自定义命令和jquery调用控制器,我解决了上述问题