我有一个Telerik Grid,在EditorTemplate中有一个Telerik TreeView,当按下一个编辑按钮时弹出,但是除非我注释掉TreeView,否则Grid的onEdit()事件不会被触发。
谷歌Chrome的调试器说:“未捕获的syntaxError:意外的令牌:”
Telerik Grid:
@{
Html.Telerik().Grid<SuperUserViewModel>()
.Name("Grid")
.DataKeys(keys => keys.Add(x => x.Id))
.ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Text)
.Text("Opret superbruger"))
.Columns(column =>
{
column.Bound(x => x.UserInitials);
column.Command(commands =>
{
commands.Edit();
commands.Delete();
});
})
.DetailView(x => x.ClientTemplate("<ul><# for (var i = 0; i < Organizations.length; i++) { if(Organizations[i].IsChecked != false){#>"
+ "<li><#= Organizations[i].Name #></li>"
+ "<# }} #></ul>"))
.EnableCustomBinding(true)
.DataBinding(dataBinding => dataBinding.Ajax()
.Select("SelectAjaxEditing", "SuperUser")
.Delete("DeleteAjaxEditing", "SuperUser")
.Update("SaveAjaxEditing", "SuperUser")
.Insert("InsertAjaxEditing", "SuperUser"))
.Pageable(paging => paging.Style(GridPagerStyles.Numeric | GridPagerStyles.PageSizeDropDown)
.Position(GridPagerPosition.Bottom))
.Editable(editing => editing.Mode(GridEditMode.PopUp))
.ClientEvents(events => events.OnDataBinding("test").OnEdit("OnEdit"))
.NoRecordsTemplate("Ingen brugere")
.Render();
}
Telerik TreeView:
@(Html.Telerik().TreeView()
.Name("organizations")
.ShowCheckBox(true)
.BindTo((IEnumerable)ViewData["organizationsAll"], mappings =>
{
mappings.For<OrganizationViewModel>(binding => binding
.ItemDataBound((current, org) =>
{
current.Text = org.Name;
current.Value = org.Id.ToString();
current.Checked = org.IsChecked;
current.Expanded = true;
})
.Children(org => org.Organizations));
}))
Chrome调试器:
Uncaught SyntaxError: Unexpected token : telerik.grid.editing.min.js:1146
b.grid.FormViewBinder.evaluatetelerik.grid.editing.min.js:1146
(anonymous function)telerik.grid.editing.min.js:1181
e.extend.proxy.gjquery-1.7.1.min.js:538
e.extend.eachjquery-1.7.1.min.js:480
e.fn.e.eachjquery-1.7.1.min.js:345
(anonymous function)telerik.grid.editing.min.js:1180
e.extend.proxy.gjquery-1.7.1.min.js:538
e.extend.eachjquery-1.7.1.min.js:476
b.grid.FormViewBinder.bindtelerik.grid.editing.min.js:1179
b.editing.implementation.editRowtelerik.grid.editing.min.js:868
(anonymous function)telerik.grid.editing.min.js:573
a.telerik.stopAlltelerik.common.min.js:1
f.event.dispatchjquery-1.7.1.min.js:1183
f.event.add.h.handle.ijquery-1.7.1.min.js:1103
答案 0 :(得分:0)
您是否考虑过使用其他API进行树视图?