Javascript 递归查找MenuItem,找到后单击它
嗨,我计划通过递归遍历所有子菜单来查找菜单项。 我已经编写了脚本,但无法调试此控制台脚本。我是新来的萤火虫。如果有人能告诉我如何调试这个脚本或者修改脚本也是很受欢迎的。提前谢谢Javascript 递归查找MenuItem,找到后单击它,javascript,extjs,recursion,menuitem,Javascript,Extjs,Recursion,Menuitem,嗨,我计划通过递归遍历所有子菜单来查找菜单项。 我已经编写了脚本,但无法调试此控制台脚本。我是新来的萤火虫。如果有人能告诉我如何调试这个脚本或者修改脚本也是很受欢迎的。提前谢谢 var QuickActionFinder = function(component, searchString) { console.log(component.id); if(component.hasOwnProperty('text')) { if(comp
var QuickActionFinder = function(component, searchString)
{
console.log(component.id);
if(component.hasOwnProperty('text'))
{
if(component.text == searchString)
{
if(component.hasOwnProperty('textEl'))
{
component.textEl.dom.click();
return;
}
}
}
if(component.hasOwnProperty('menu'))
{
var count = component.menu.items.length;
for(var i=0;i < count;count++)
{
var comp = component.menu.items.itemAt(i);
QuickActionFinder(comp,searchString)
}
}
else
{
return;
}
}
var comp = window.frames[2].Ext.getCmp('ext-comp-2515'); QuickActionFinder(comp,'Mobile')
var QuickActionFinder=函数(组件,搜索字符串)
{
console.log(component.id);
if(component.hasOwnProperty('text'))
{
if(component.text==searchString)
{
if(component.hasOwnProperty('textEl'))
{
component.textEl.dom.click();
返回;
}
}
}
if(component.hasOwnProperty('menu'))
{
var count=component.menu.items.length;
对于(变量i=0;i
我认为您可以使用Ext.ComponentQuery.query()
代替。如果结果中有重复项,我不想使用索引或css定位器。