extjs 4树通过两个内部id选择特定节点
我们可以使用以下代码通过内部id在ExtJs 4 TreeStore中搜索记录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
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
。