Kendo ui 剑道UI-弹出编辑器网格内的子网格

Kendo ui 剑道UI-弹出编辑器网格内的子网格,kendo-ui,kendo-grid,kendo-asp.net-mvc,Kendo Ui,Kendo Grid,Kendo Asp.net Mvc,我目前正在使用MVC4 KendoUI项目C#和Razor引擎。 在网上搜索了很多之后,我找不到实现这一点的方法: 我有一个基于我的模型的剑道网格,它是一个“卫星”对象的集合,它有一些属性,其中一个属性是“转发器”对象的列表 我的“卫星”视图有CRUD,它包含在一个可编辑的剑道网格中,这个网格不显示所有字段,我希望在可编辑模式下,您可以编辑和更新其所有属性,因此我提出了一个编辑器模板,然后当用户单击“编辑”时按钮I显示一个自定义局部视图,其中包含所有要更新的字段。这对我来说很好,除非我为“应答器

我目前正在使用MVC4 KendoUI项目C#和Razor引擎。 在网上搜索了很多之后,我找不到实现这一点的方法:

我有一个基于我的模型的剑道网格,它是一个“卫星”对象的集合,它有一些属性,其中一个属性是“转发器”对象的列表

我的“卫星”视图有CRUD,它包含在一个可编辑的剑道网格中,这个网格不显示所有字段,我希望在可编辑模式下,您可以编辑和更新其所有属性,因此我提出了一个编辑器模板,然后当用户单击“编辑”时按钮I显示一个自定义局部视图,其中包含所有要更新的字段。这对我来说很好,除非我为“应答器”列表创建了另一个网格,它似乎不能正常工作。我能够加载网格,成功执行读取操作,但当我单击“transponder”网格内的“delete”(删除)按钮时,该项目从网格中消失,但不会进入控制器,也不会在服务器端执行任何操作。如果我再次更新和编辑,该项目仍然存在

我也想知道你们是否认为我的方法是正确的,或者你们是否知道一种更直接的方法

我发现最相似的情况是这样的

这不完全是,但我想,但给你一个想法,我假装达到

这是“卫星”积垢视图:

@model IEnumerable<Test_MVC_DTV.Models.Satelite>

@{
    ViewBag.Title = "Satelites";
}

<style>
        #organizer { 
            width: auto;
            margin: 0 auto;
        }

    .k-edit-form-container { width: auto; height: auto;}
    </style>


<div id="organizer">
        @(Html.Kendo().PanelBar()
            .Name("panelbar")
            .ExpandMode(PanelBarExpandMode.Multiple)
            .HtmlAttributes(new { style = "min-width: 800px; width: auto;margin: auto;" })
            .Items(panelbar =>
                {
                    panelbar.Add()
                            .Text("Satélites")
                            .Expanded(true)

                            .Content(@<div style="padding: 10px;">
                                          <section>
                                              Nombre: <input style="margin-left: 7px" id="txtNombre"/> 
                                              <button style="margin-left: 10px" class="k-button" id="btnBuscar">BUSCAR</button>

                                          </section>
                                      </div>);

                })

        ) 
    </div>

@(Html.Kendo().Grid(Model)    
      .Name("grdSatelites")
      .Columns(columns =>
          {
              columns.Bound(p => p.SateliteId).Groupable(false);
              columns.Bound(p => p.Denominacion);
              columns.Bound(p => p.Comentario);

              columns.Command(cmd =>
                  {
                      cmd.Edit().Text("Editar").CancelText("Cancelar").UpdateText("Actualzar");
                      cmd.Destroy().Text("Eliminar");

                  })
                .HtmlAttributes(new {style="text-align:center;"})
                .Width(210);

          })
        .Editable(editable =>
          {
              editable.Mode(GridEditMode.PopUp).Window(wdw=>wdw.Title("Editor Satelite"));
              editable.TemplateName("SatelitesEditor");

          })
      .Events(e=>e.Edit("OnEdit"))
      .Pageable()
      .Sortable()      
      .Scrollable()
      .Filterable()
      .Selectable()
      .ToolBar(toolbar => toolbar.Create().Text("Agregar") )

      .DataSource(dataSource => dataSource 
                                    .Ajax()
                                    .PageSize(5)
                                    .ServerOperation(false)
                                    .Model(model =>
                                    {
                                        model.Id(p => p.SateliteId);
                                        model.Field(p => p.SateliteId).Editable(false);
                                    })
                                    .Read(read => read.Action("Satelites_Read", "Home").Type(HttpVerbs.Post))
                                    .Create(create => create.Action("Satelites_Create", "Home"))
                                    .Destroy(destroy => destroy.Action("Satelites_Delete", "Home"))
                                    .Update(update => update.Action("Satelites_Update", "Home"))
      )

    )

<script>

    $(function () {

        $("#btnBuscar").click(function () {
            var $filter = new Array();
            var $nombre = $("#txtNombre").val();
            if ($nombre) {
                $filter.push({ field: "Nombre", operator: "contains", value: $nombre });
            }
            var grid = $("#kendoGrid").data("kendoGrid");
            grid.dataSource.filter($filter);
        });
    });

    function OnEdit(e) {
        $('#grdTransponders').data().kendoGrid.dataSource.read({ SateliteId: e.model.SateliteId });

    }
</script>
@model Test_MVC_DTV.Models.Satelite

<div style="padding: 10px; margin: 10px">
            @Html.Label("Denominación:")
            @Html.EditorFor(m => m.Denominacion )

            @Html.Label("Ubicacion Orbital:")
            @Html.EditorFor(m => m.UbicacionOrbital )

            @Html.Label("Comentario:")
            @Html.EditorFor(m => m.Comentario )



    @(Html.Kendo().Grid(Model.Transponders)
            .Name("grdTransponders")
            .Columns(columns =>
            {
                columns.Bound(p => p.TransponderID).Groupable(false);
                columns.Bound(p => p.Polaridad);
                columns.Bound(p => p.Haz);
                columns.Bound(p => p.UsuarioAsignado);
                columns.Bound(p => p.color);
                columns.Command(cmd =>
                {
                    cmd.Edit().Text("Editar").UpdateText("Actualizar").CancelText("Cancelar");
                    cmd.Destroy().Text("Eliminar");

                })
                         .HtmlAttributes(new { style = "text-align:center;" })
                         .Width(210);

            })
            .Editable(editable => {
                                      editable.Mode(GridEditMode.PopUp);
                                      editable.TemplateName("TranspondersEditor");
            })

            .ToolBar(toolbar => toolbar.Create().Text("Agregar") )
            .AutoBind(false)
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(5)
                .ServerOperation(false)               
                .Model(model =>
                    {
                        model.Id(p => p.TransponderID);
                        model.Field(p => p.TransponderID).Editable(false);
                    })
                .Read(read => read.Action("Transponders_Read", "Home").Type(HttpVerbs.Post))
                .Create(create => create.Action("Transponders_Create", "Home"))
                .Destroy(destroy => destroy.Action("Transponders_Delete", "Home"))
                .Update(update => update.Action("Transponders_Update", "Home"))
            )
            .Pageable()

    )
    </div>
@model IEnumerable
@{
ViewBag.Title=“卫星”;
}
#组织者{
宽度:自动;
保证金:0自动;
}
.k-edit-form-container{宽度:自动;高度:自动;}
@(Html.Kendo().PanelBar())
.名称(“panelbar”)
.ExpandMode(PanelBarExpandMode.Multiple)
.HtmlAttributes(新的{style=“最小宽度:800px;宽度:自动;边距:自动;“})
.项目(面板栏=>
{
panelbar.Add()
.文本(“卫星”)
.扩展(真)
.内容(@
名义:
客车
);
})
) 
@(Html.Kendo().Grid(模型)
.名称(“GRD卫星”)
.列(列=>
{
columns.Bound(p=>p.SateliteId).Groupable(false);
columns.Bound(p=>p.Denominacion);
columns.Bound(p=>p.Comentario);
columns.Command(cmd=>
{
cmd.Edit().Text(“Editar”).CancelText(“Cancelar”).UpdateText(“Actualzar”);
cmd.Destroy().Text(“Eliminar”);
})
.HtmlAttributes(新的{style=“text align:center;”})
.宽度(210);
})
.可编辑(可编辑=>
{
可编辑.Mode(GridEditMode.PopUp).Window(wdw=>wdw.Title(“编辑器卫星”));
可编辑.TemplateName(“卫星编辑”);
})
.Events(e=>e.Edit(“OnEdit”))
.Pageable()
.Sortable()
.Scrollable()
.可过滤()
.可选()
.ToolBar(ToolBar=>ToolBar.Create().Text(“Agregar”))
.DataSource(DataSource=>DataSource
.Ajax()
.页面大小(5)
.ServerOperation(错误)
.Model(Model=>
{
Id(p=>p.SateliteId);
model.Field(p=>p.SateliteId).Editable(false);
})
.Read(Read=>Read.Action(“卫星读取”,“主页”).Type(HttpVerbs.Post))
.Create(Create=>Create.Action(“卫星创建”、“主页”))
.Destroy(Destroy=>Destroy.Action(“卫星删除”,“主页”))
.Update(Update=>Update.Action(“卫星更新”、“主页”))
)
)
$(函数(){
$(“#btnBuscar”)。单击(函数(){
var$filter=新数组();
var$nombre=$(“#txtNombre”).val();
如果($nombre){
$filter.push({字段:“Nombre”,运算符:“contains”,值:$Nombre});
}
var网格=$(“#kendoGrid”).data(“kendoGrid”);
grid.dataSource.filter($filter);
});
});
功能OneEdit(e){
$('#grdtresponders').data().kendoGrid.dataSource.read({SateliteId:e.model.SateliteId});
}
这是编辑器模板:

@model IEnumerable<Test_MVC_DTV.Models.Satelite>

@{
    ViewBag.Title = "Satelites";
}

<style>
        #organizer { 
            width: auto;
            margin: 0 auto;
        }

    .k-edit-form-container { width: auto; height: auto;}
    </style>


<div id="organizer">
        @(Html.Kendo().PanelBar()
            .Name("panelbar")
            .ExpandMode(PanelBarExpandMode.Multiple)
            .HtmlAttributes(new { style = "min-width: 800px; width: auto;margin: auto;" })
            .Items(panelbar =>
                {
                    panelbar.Add()
                            .Text("Satélites")
                            .Expanded(true)

                            .Content(@<div style="padding: 10px;">
                                          <section>
                                              Nombre: <input style="margin-left: 7px" id="txtNombre"/> 
                                              <button style="margin-left: 10px" class="k-button" id="btnBuscar">BUSCAR</button>

                                          </section>
                                      </div>);

                })

        ) 
    </div>

@(Html.Kendo().Grid(Model)    
      .Name("grdSatelites")
      .Columns(columns =>
          {
              columns.Bound(p => p.SateliteId).Groupable(false);
              columns.Bound(p => p.Denominacion);
              columns.Bound(p => p.Comentario);

              columns.Command(cmd =>
                  {
                      cmd.Edit().Text("Editar").CancelText("Cancelar").UpdateText("Actualzar");
                      cmd.Destroy().Text("Eliminar");

                  })
                .HtmlAttributes(new {style="text-align:center;"})
                .Width(210);

          })
        .Editable(editable =>
          {
              editable.Mode(GridEditMode.PopUp).Window(wdw=>wdw.Title("Editor Satelite"));
              editable.TemplateName("SatelitesEditor");

          })
      .Events(e=>e.Edit("OnEdit"))
      .Pageable()
      .Sortable()      
      .Scrollable()
      .Filterable()
      .Selectable()
      .ToolBar(toolbar => toolbar.Create().Text("Agregar") )

      .DataSource(dataSource => dataSource 
                                    .Ajax()
                                    .PageSize(5)
                                    .ServerOperation(false)
                                    .Model(model =>
                                    {
                                        model.Id(p => p.SateliteId);
                                        model.Field(p => p.SateliteId).Editable(false);
                                    })
                                    .Read(read => read.Action("Satelites_Read", "Home").Type(HttpVerbs.Post))
                                    .Create(create => create.Action("Satelites_Create", "Home"))
                                    .Destroy(destroy => destroy.Action("Satelites_Delete", "Home"))
                                    .Update(update => update.Action("Satelites_Update", "Home"))
      )

    )

<script>

    $(function () {

        $("#btnBuscar").click(function () {
            var $filter = new Array();
            var $nombre = $("#txtNombre").val();
            if ($nombre) {
                $filter.push({ field: "Nombre", operator: "contains", value: $nombre });
            }
            var grid = $("#kendoGrid").data("kendoGrid");
            grid.dataSource.filter($filter);
        });
    });

    function OnEdit(e) {
        $('#grdTransponders').data().kendoGrid.dataSource.read({ SateliteId: e.model.SateliteId });

    }
</script>
@model Test_MVC_DTV.Models.Satelite

<div style="padding: 10px; margin: 10px">
            @Html.Label("Denominación:")
            @Html.EditorFor(m => m.Denominacion )

            @Html.Label("Ubicacion Orbital:")
            @Html.EditorFor(m => m.UbicacionOrbital )

            @Html.Label("Comentario:")
            @Html.EditorFor(m => m.Comentario )



    @(Html.Kendo().Grid(Model.Transponders)
            .Name("grdTransponders")
            .Columns(columns =>
            {
                columns.Bound(p => p.TransponderID).Groupable(false);
                columns.Bound(p => p.Polaridad);
                columns.Bound(p => p.Haz);
                columns.Bound(p => p.UsuarioAsignado);
                columns.Bound(p => p.color);
                columns.Command(cmd =>
                {
                    cmd.Edit().Text("Editar").UpdateText("Actualizar").CancelText("Cancelar");
                    cmd.Destroy().Text("Eliminar");

                })
                         .HtmlAttributes(new { style = "text-align:center;" })
                         .Width(210);

            })
            .Editable(editable => {
                                      editable.Mode(GridEditMode.PopUp);
                                      editable.TemplateName("TranspondersEditor");
            })

            .ToolBar(toolbar => toolbar.Create().Text("Agregar") )
            .AutoBind(false)
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(5)
                .ServerOperation(false)               
                .Model(model =>
                    {
                        model.Id(p => p.TransponderID);
                        model.Field(p => p.TransponderID).Editable(false);
                    })
                .Read(read => read.Action("Transponders_Read", "Home").Type(HttpVerbs.Post))
                .Create(create => create.Action("Transponders_Create", "Home"))
                .Destroy(destroy => destroy.Action("Transponders_Delete", "Home"))
                .Update(update => update.Action("Transponders_Update", "Home"))
            )
            .Pageable()

    )
    </div>
@model Test\u MVC\u DTV.Models.Satelite
@Label(“Denominación:”)
@EditorFor(m=>m.Denominacion)
@标签(“Ubicacion轨道:”)
@EditorFor(m=>m.UbicacionOrbital)
@标签(“Comentario:”)
@EditorFor(m=>m.Comentario)
@(Html.Kendo().Grid(Model.transponder)
.名称(“GRD响应者”)
.列(列=>
{
columns.Bound(p=>p.transanderId).Groupable(false);
columns.Bound(p=>p.Polaridad);
columns.Bound(p=>p.Haz);
columns.Bound(p=>p.usuariasignado);
columns.Bound(p=>p.color);
columns.Command(cmd=>
{
cmd.Edit().Text(“Editar”).UpdateText(“实施”).CancelText(“取消”);
cmd.Destroy().Text(“Eliminar”);
})
.HtmlAttributes(新的{style=“text align:center;”})
.宽度(210);
})
.可编辑(可编辑=>{