簡體   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