内部网格读取操作不在kendo网格中调用 [英] Inner grid read action is not calling in kendo grid

查看:90
本文介绍了内部网格读取操作不在kendo网格中调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,

我正在尝试使用mvc在kendo网格内构建一个嵌套网格..



为此我正在使用两个列表加载动作bcs两个网格需要加载..



这里的问题是,

第二次加载动作,这意味着内部网格加载动作是不叫..

请帮忙解决这个问题... \\





这是我的浏览页面:



Hi friends,
I am trying to build a nested grid inside kendo grid using mvc..

For this i am using Two list load action bcs two grid need to load..

Problem here is,
second load action which means inner grid load action is not called..
pls hel pme to solve this issue...\\


this is my view page:

@(Html.Kendo().Grid<ParentModel>()
            .Name("grd")
        .Columns(columns =>
        {
            columns.Bound(e => e.FirstName).Width(110);
         

        })
        .Sortable()
        .Pageable()
        .Scrollable()
        .ClientDetailTemplateId("template")
        .HtmlAttributes(new { style = "height:430px;" })
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(6)
                    .Read(read => read.Action("SampleAction", "ControllerName").Data("passSampleId"))
        )
            .ClientDetailTemplateId("template")
            .Events(events => events.DataBound("dataBound"))
)

<script id="template" type="text/html">
    <div>
        @(Html.Kendo().Grid<ChildModel>()
                            .Name("grd")
            .Columns(columns =>
            {
                columns.Bound(o => o.Sample).Width(70);
                columns.Bound(o => o.Sample).Width(110);
             
                columns.Command(o => o.Edit().Text("Reschedule")).Title("Commands");
                columns.Command(o => o.Edit().Text("Confirm")).Title("Commands");
            })
            .DataSource(dataSource => dataSource
                .Ajax()
                .Model(model => model.Id(c => c.SampleId))
                .PageSize(10)
                   .Read(read => read.Action("LoadReadAction", "ControllerName", new { SampleId= "1" }))
                                   .Update(Update => Update.Action("LoadEditAction", "ControllerName", new { SampleId= "1" }))
                                           .Update(Update => Update.Action("LoadEditAction", "ControllerName", new { SampleId= "1" }))
            )
            .Pageable()
            .Sortable()
            .ToClientTemplate()
        )
    </div>
    </script>
<script>
    function dataBound() {
        this.expandRow(this.tbody.find("tr.k-master-row").first());
    }
</script>

推荐答案

两个网格的名称属性相同。这应该是唯一的,因为Name成为网格的id并且id本质上是唯一的。

此外,不是直接在.Action方法中传递SampleId而是使用.Data属性像在外部网格中那样将其他数据传递给Action Method。



希望这会有所帮助!
The "Name" property of both the grids are same. This should be unique as "Name" becomes the id of the grid and ids are unique by nature.
Also, Instead of passing the "SampleId" directly in the .Action method use ".Data" property to pass additional data to Action Method as you have done in Outer grid.

Hope this helps!


这篇关于内部网格读取操作不在kendo网格中调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆