繁体   English   中英

在Ext GWT 3.0 Tree中展开并选择节点

[英]Expand and select node in Ext GWT 3.0 Tree

我在其第一个内容窗格中添加了一个带有树的手风琴布局容器到我的布局。 不,需求调用扩展并在加载应用程序时选择一个节点(它是一个模型)。

然后我将它添加到类的构造函数中,它与uibinder布局相对应:

widget = uiBinder.createAndBindUi(this);               // everything's bound

accordionLayoutContainer.setActiveWidget(firstPanel);  // OK, expands first pane
tree.getSelectionModel().select(mynode, true);        // no visible effect
tree.setExpanded(mynode, false);                       // no visible effect

这里缺少什么? 设置状态后是否必须强制“某事”的布局,或者选择和扩展节点是否错误?

找到了解决方案。 必须延迟对setExpand的调用,直到附加了树。 所以我将一个AttachEvent.Handler添加到父窗口小部件 - 将它直接添加到树中是行不通的,因为在注册模型之前,会提前调用处理程序。

widget = uiBinder.createAndBindUi(this);               // everything's bound

accordionLayoutContainer.setActiveWidget(firstPanel);  // OK, expands first pane
accordionLayoutContainer.addAttachHandler(new AttachEvent.Handler() {

  @Override
  public void onAttachOrDetach(AttachEvent event) {
    clientsTree.getSelectionModel().select(mynode, true);
    clientsTree.setExpanded(mynode, true);              
  }
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM