Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.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
extjs 4树通过两个内部id选择特定节点_Extjs_Extjs4.1 - Fatal编程技术网

extjs 4树通过两个内部id选择特定节点

extjs 4树通过两个内部id选择特定节点,extjs,extjs4.1,Extjs,Extjs4.1,我们可以使用以下代码通过内部id在ExtJs 4 TreeStore中搜索记录 var record = tree.getRootNode().findChild('id_name','XYZ',true); 假设我想搜索一条记录,其中id\u name应该是XYZ和age 10。 我们是否有允许用户搜索多个内部Id的方法 好的,id,无论它被称为“id”还是“id\u name”,对于树中的每个节点都必须是唯一的,因此findChild始终只返回一个节点,不需要其他搜索条件。使用findCh

我们可以使用以下代码通过内部id在ExtJs 4 TreeStore中搜索记录

var record = tree.getRootNode().findChild('id_name','XYZ',true);
假设我想搜索一条记录,其中
id\u name
应该是
XYZ
age 10

我们是否有允许用户搜索多个内部Id的方法

好的,id,无论它被称为“id”还是“id\u name”,对于树中的每个节点都必须是唯一的,因此findChild始终只返回一个节点,不需要其他搜索条件。

使用findChildBy此处:

var record = tree.getRootNode().findChildBy(
    function(node) {
        return node.get('id_name') == this.requiredIdName && node.get('age') == this.requiredAge;
    },
    {
       // Putting the search criteria stuff in the context used for the function
       requiredAge: 10,
       requiredIdName: 'abc'
    },
    // true to do a deep search, false to search only on first level
    true
);

谢谢你的快速回复。我的意思是,假设我的商店使用的模型有4个属性,
ID、Name、Age、Salary
。现在我只想找到一条记录,其中姓名是
XYZ
,年龄是
20