Kendo详细信息网格返回无效模板

时间:2015-02-23 20:18:07

标签: kendo-ui kendo-grid kendo-asp.net-mvc

我有2个网格,一个在另一个的详细模板中作为下面的代码,但是当我尝试运行此代码时它返回错误说无效模板,因为2个网格完全相同我无法理解为什么细节模板刹车。如果我整体删除一些列,并从2列自定义编辑器模板中删除它,但我需要它才能正常工作。可能导致这种情况的任何想法?

@(Html.Kendo().Grid<Model>()
            .Name("res")
            .Columns(columns =>
            {
                columns.Bound(p => p.ID).Title("ID").Width(50);
                columns.Bound(p => p.Type).EditorTemplateName("DropdownType").ClientTemplate("#=Type.Value#").Title("Type").Width(160);
                columns.Bound(p => p.Org).EditorTemplateName("DropdownOrg").ClientTemplate("#=Org.Value#").Title("Org").Width(100);
                columns.Bound(p => p.Name).Title("Name").Width(150);
                columns.Bound(p => p.Quantity).EditorTemplateName("Double").Title("Quantity").Width(80);
                columns.Bound(p => p.QuantityUOM).EditorTemplateName("DropdownQuantityUOM").ClientTemplate("#=QuantityUOM.Value#").Title("Quantity UOM").Width(80);
                columns.Bound(p => p.Area).ClientTemplate("#= Area.Value #").EditorTemplateName("DropdownAreas").Title("Area of Operation").Width(120);
                columns.Bound(p => p.Date).EditorTemplateName("DateTimeSmaller").Title("Date").Width(100);
                columns.Bound(p => p.ETA).EditorTemplateName("DateTimeSmaller").Title("ETA").Width(100);
                columns.Bound(p => p.Arrived).EditorTemplateName("Checkbox").Title("Arrived").ClientTemplate("<input type='checkbox' #= Arrived ? checked='checked' : '' # ></input>").Width(60);
                columns.Bound(p => p.Status).ClientTemplate("#=Status.Value#").EditorTemplateName("DropdownStatus").Title("Status").Width(100);
                columns.Bound(p => p.Tactical).EditorTemplateName("Checkbox").Title("Tactical").ClientTemplate("<input type='checkbox' #= IsTactical ? checked='checked' : '' # ></input>").Width(60);

            })
            .ToolBar(toolbar =>
            {
                toolbar.Save();
            })
            .Editable(editable => editable.Mode(GridEditMode.InCell))
            .Navigatable()
            .Filterable()
            .Events(e =>
            {
                e.FilterMenuInit("initCheckboxFilter");
            })
            .Sortable()
            .Scrollable(scrollable => scrollable.Height(320))
            .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
            .Groupable()
            .Resizable(resize => resize.Columns(true))
            .Reorderable(reorder => reorder.Columns(true))
            .DataSource(dataSource => dataSource
            .Ajax()
            .Batch(true)
            .ServerOperation(false)
            .Model(model =>
            {
                model.Id(p => p.ID);
            })
            .Read(read =>
                        read.Action("Read", "Controller")
                            .Data("filterByPeriod")
                 )
            .Create("Create", "Controller")
            .Update("Update", "Controller")
            .Destroy(destroy => destroy.Action("Destroy", "Controller"))
            )
            .ClientDetailTemplateId("resourceTemplate")
    )
    <script type="text/kendo" id="resourceTemplate">
        @(Html.Kendo().Grid<Model>()
            .Name("resObj")
            .Columns(columns =>
            {
                columns.Bound(p => p.ID).Title("ID").Width(50);
                columns.Bound(p => p.Type).EditorTemplateName("DropdownType").ClientTemplate("#=Type.Value#").Title("Type").Width(160);
                columns.Bound(p => p.Org).EditorTemplateName("DropdownOrg").ClientTemplate("#=Org.Value#").Title("Org").Width(100);
                columns.Bound(p => p.Name).Title("Name").Width(150);
                columns.Bound(p => p.Quantity).EditorTemplateName("Double").Title("Quantity").Width(80);
                columns.Bound(p => p.QuantityUOM).EditorTemplateName("DropdownQuantityUOM").ClientTemplate("#=QuantityUOM.Value#").Title("Quantity UOM").Width(80);
                columns.Bound(p => p.Area).ClientTemplate("#= Area.Value #").EditorTemplateName("DropdownAreas").Title("Area of Operation").Width(120);
                columns.Bound(p => p.Date).EditorTemplateName("DateTimeSmaller").Title("Date").Width(100);
                columns.Bound(p => p.ETA).EditorTemplateName("DateTimeSmaller").Title("ETA").Width(100);
                columns.Bound(p => p.Arrived).EditorTemplateName("Checkbox").Title("Arrived").ClientTemplate("<input type='checkbox' #= Arrived ? checked='checked' : '' # ></input>").Width(60);
                columns.Bound(p => p.Status).ClientTemplate("#=Status.Value#").EditorTemplateName("DropdownStatus").Title("Status").Width(100);
                columns.Bound(p => p.Tactical).EditorTemplateName("Checkbox").Title("Tactical").ClientTemplate("<input type='checkbox' #= IsTactical ? checked='checked' : '' # ></input>").Width(60);
            })
            .Editable(editable => editable.Mode(GridEditMode.InCell))
            .Navigatable()
            .Sortable()
            .Scrollable()
            .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
            .DataSource(dataSource => dataSource
            .Ajax()
            .Batch(true)
            .ServerOperation(true)
            .Model(model =>
            {
                model.Id(p => p.ID);
            })

            .Read(read =>
                        read.Action("Read", "Controller",
                                 new { ID = "#=ID#" }))

            .Create("Create", "Controller")
            .Update("Update", "Controller")
            .Destroy(destroy => destroy.Action("Destroy", "Controller"))
            )
            .ClientDetailTemplateId("clientTemplate")
        )
@(Html.Kendo().Grid<Model>()
            .Name("res")
            .Columns(columns =>
            {
                columns.Bound(p => p.ID).Title("ID").Width(50);
            })
            .ToolBar(toolbar =>
            {
                toolbar.Save();
            })
            .Editable(editable => editable.Mode(GridEditMode.InCell))
            .Navigatable()
            .Filterable()
            .Events(e =>
            {
                e.FilterMenuInit("initCheckboxFilter");
            })
            .Sortable()
            .Scrollable(scrollable => scrollable.Height(320))
            .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
            .Groupable()
            .Resizable(resize => resize.Columns(true))
            .Reorderable(reorder => reorder.Columns(true))
            .DataSource(dataSource => dataSource
            .Ajax()
            .Batch(true)
            .ServerOperation(false)
            .Model(model =>
            {
                model.Id(p => p.ID);
            })
            .Read(read =>
                        read.Action("Read", "Controller")
                            .Data("filterByPeriod")
                 )
            .Create("Create", "Controller")
            .Update("Update", "Controller")
            .Destroy(destroy => destroy.Action("Destroy", "Controller"))
            )
            .ClientDetailTemplateId("resourceTemplate")
    )
    <script type="text/kendo" id="resourceTemplate">
        @(Html.Kendo().Grid<Model>()
            .Name("resObj")
            .Columns(columns =>
            {
                columns.Bound(p => p.ID).Title("ID");
            })
            .Editable(editable => editable.Mode(GridEditMode.InCell))
            .Navigatable()
            .Sortable()
            .Scrollable()
            .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
            .DataSource(dataSource => dataSource
            .Ajax()
            .Batch(true)
            .ServerOperation(true)
            .Model(model =>
            {
                model.Id(p => p.ID);
            })

            .Read(read =>
                        read.Action("Read", "Controller",
                                 new { ID = "#=ID#" }))

            .Create("Create", "Controller")
            .Update("Update", "Controller")
            .Destroy(destroy => destroy.Action("Destroy", "Controller"))
            )
            .ToClientTemplate()
        )
</script>

0 个答案:

没有答案