2018年4月9日 星期一

Kendo UI Grid 摺疊明細裡面再一個Grid 的抓法 | How to get Kendo UI Grid with children detail's grid

markdown

#背景
同事在寫的應用:一個GRID裡面有子GRID
資料在展開master row時才會去抓
但不知道怎麼抓

#解法
我第一個想法是在master grid展開前先記住外面row的uid,
再用uid反推index,再用index去抓到row,再抓到裡面的grid,但很麻煩;

他研究很久後發現在master grid 的detailInit事件做detail grid宣告,
detail grid裡的databound事件
可以用
```
$(this.element[0]).data("kendoGrid"); ```
來抓到裡面的grid,簡單明瞭