How to get a different grid as child from a different row of another grid using Kendo detailInit function

落爺英雄遲暮 提交于 2019-12-12 02:45:20

问题


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.

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 Sample Code


回答1:


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;     
});

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 example to demonstrate the above.



来源:https://stackoverflow.com/questions/44545719/how-to-get-a-different-grid-as-child-from-a-different-row-of-another-grid-using

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!