Zan*_*ngo 15
我为你写了这个功能.我认为它会对你有所帮助.
Run Code Online (Sandbox Code Playgroud)
它将面板(容器)作为参数,并递归返回所有子项和子项.
function getAllChildren (panel) {
/*Get children of passed panel or an empty array if it doesn't have thems.*/
var children = panel.items ? panel.items.items : [];
/*For each child get their children and concatenate to result.*/
Ext.each(children, function (child) {
children = children.concat(getAllChildren(child));
})
return children;
}
编辑
这将返回儿童的ID.使用以前的功能 - getAllChilden
function getAllChildenIds(panel) {
//*Get all child items. \*/
var children = getAllChilden(panel);
//*Replace items with their ids.\*/
for (var i=0, l=children.length; i < l; i++) {
children[i] = children[i].getId();
}
return children;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22592 次 |
| 最近记录: |