我尝试使用以下代码选择/突出显示嵌套列表项:
var activelist= nestedList.getActiveItem();
var listselectednode = activelist.getNode(1);
nestedPanel.fireEvent('itemtap',activelist,1,listselectednode ,e);
但不行。
帮助
答案 0 :(得分:0)
为了后人,这里是你如何选择(突出显示)一个节点。这个答案改编自对这个问题的评论。
var activeList = nestedList.getActiveItem();
// By index<br/>
activeList.getSelectionModel().select(index)
// By ID<br/>
var targetNode = activeList.store.getById(id);
activeList.getSelectionModel().select(targetNode);
以下是您选择和点击节点的方式(按ID)。
var activeList = nestedList.getActiveItem();
var targetNode = activeList.getNode(activeList.store.getById(targetNodeId));
var e = {} // You can provide event data here, if you like.
if (targetNode) {
var targetIndex = activeList.indexOf(targetNode);
nestedList.fireEvent('itemtap', activeList, targetIndex, targetNode , e);
activeList.getSelectionModel().select(targetIndex, true);
}