Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在MixedCollection中搜索项目_Javascript_Search_Extjs - Fatal编程技术网

Javascript 在MixedCollection中搜索项目

Javascript 在MixedCollection中搜索项目,javascript,search,extjs,Javascript,Search,Extjs,我使用extjs,所以 我有一个带有项目(按钮、标签等)的工具栏。我向工具栏添加元素,如下所示: toolbar.add(this.tempObject); 或者像这样: toolbar.add({ xtype: button, ... }); 因此,我想通过字段“ref”在这个工具栏中查找一些元素。我试图: toolbar.items.find(new Function("there should be my function, but i have no idea how

我使用extjs,所以

我有一个带有项目(按钮、标签等)的工具栏。我向工具栏添加元素,如下所示:

toolbar.add(this.tempObject);
或者像这样:

toolbar.add({
    xtype: button,
    ...
});
因此,我想通过字段
“ref”
在这个工具栏中查找一些元素。我试图:

toolbar.items.find(new Function("there should be my function, but i have no idea how to write it"));
而且没有保证这个集合中的每个元素都有这个字段

使用findBy方法:

toolbar.items.findBy(c => c.ref == 'the value you want');

关于容器上的子项,还有其他方法,但这取决于Ext版本和您要查找的内容。

也许您知道一些参考资料,我可以在其中看到,如何制作函数,就像您所做的那样?它被称为箭头函数,是es6 see的一部分