asp.Net   发布时间:2022-04-07  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了asp.net-mvc – Kendo UI Grid一次只扩展一行大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个Kendo Grid,我希望一次只能扩展一行进行细节编辑.最简单的方法是什么?
@(Html.Kendo().Grid<Mymodel>()
   .Name("MyGrid")
   .ClientDetailTemplatEID("myTemplate")
   .columns(columns =>
   {
       columns.bound(b => b.CodE);
       columns.bound(b => b.Name);
       columns.bound(b => b.Description);
       ...
       columns.Command(cmd => { cmd.Edit(); cmd.Destroy(); });
   })
   .ToolBar(toolbar => toolbar.Create())
   .Editable(editable => editable.Mode(GridEditMode.InLinE))
   .Datasource(datasource => datasource
      .Ajax()
      .Model(model => model.Id(a => a.Id))
      .Create(create => create.Action("Create","Sysmaint",new { id = Model.ProjectId }))
      .Read(read => read.action("Read",new { projectId = Model.ProjectId }))
      .update(update => update.Action("update","Sysmaint"))
      .Destroy(destroy => destroy.Action("Destroy","Sysmaint"))
   )
)

<script id="myTemplate" type="text/kendo-tmpl">
    @(Html.Kendo().TabStrip()
       .Name("TabStrip_#=Id#")
       .SELEctedIndex(0)
       .Items(items =>
           {
               items.Add().Text("A").LoadContentFrom("MyPartialA",new { id = "#=Id#" });
               items.Add().Text("B").LoadContentFrom("MyPartialB",new { id = "#=Id#" });
           })
       .ToClientTemplate()
    )
</script>
@H_262_5@解决方法
结束这很简单.只需添加这几行.
...
      .update(update => update.Action("update","Sysmaint"))
   )
   .Events(events => events.DetailExpand("detailExpand"))
)

<script type="text/javascript">
    var expandedRow;
    function detailExpand(E) {
        // Only one open at a time
        if (expandedRow != null && expandedRow[0] != e.masterRow[0]) {
            var grid = $('#MyGrid').data('kendoGrid');
            grid.collapseRow(expandedRow);
        }
        expandedRow = e.masterRow;
    }
</script>

我希望这有助于某人.

大佬总结

以上是大佬教程为你收集整理的asp.net-mvc – Kendo UI Grid一次只扩展一行全部内容,希望文章能够帮你解决asp.net-mvc – Kendo UI Grid一次只扩展一行所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。