如何使用Kendo detailInit函数从另一个网格的不同行中获取另一个作为孩子的不同网格 [英] How to get a different grid as child from a different row of another grid using Kendo detailInit function

查看:287
本文介绍了如何使用Kendo detailInit函数从另一个网格的不同行中获取另一个作为孩子的不同网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个网格,每行带有按钮,单击该按钮会打开一个弹出窗口,每个按钮上的网格都不同.

I have made a grid with buttons in each row which on-click opens a pop-up having different grids on each button.

弹出网格的每一行都可以有一个子对象(另一个只有一列的网格).如果没有孩子,则应该为空.

Each row of the pop-up grid may have a child (another grid with only one column). And if there is no child it should be empty.

因此,我正尝试使用给定示例中所示的parent-Id(PId)和(Id)来将每个子行与一个子项映射,这会将所有可用子项都排成一行,或者不将任何子项都排成一行它.

So, I'm trying to map each row with a child using parent-Id(PId) and (Id) as shown in the given example, which is taking all the available child's into a row or taking none of them into it.

Dojo示例代码

推荐答案

使用detailInit需要一种稍微不同的方法来公开属于父项的数据.您可以像这样使用e.data提取此数据:

Using detailInit requires a slightly different method of exposing the data belonging to the parent item. You can extract this data using e.data like so:

var newData2 = crdata.filter(function(ell) {
    return ell.NId == e.data.Id && ell.PId != 0;     
});

除了检查dataSource NId =父行ID并将子网格的dataSource设置移动到detailInit函数本身之外,这还可以解决问题.

That along with checking that the dataSource NId = parent row Id and moving the setup of the dataSource for the child grid into the detailInit function itself should do the trick.

Dojo示例来演示上述内容.

这篇关于如何使用Kendo detailInit函数从另一个网格的不同行中获取另一个作为孩子的不同网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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