2012-02-13 8 views
0

私はウィジェットを使ってレイアウトを作成する関数を持っています。問題は、ウィジェットの1つが仮想ツリー(レイアウトの左側)であり、右側の2番目のウィジェットが左側のクリックされた行に依存することです。仮想ツリーはメニューのように動作し、行名の値を右側のウィジェットに戻し、提供されたデータで右側に再作成する必要があります。しかし、現在は再作成するのではなく、新しいウィジェットを古いものに追加しています。右側のウィジェットを既存のものに追加しないで再作成する方法(インターフェイスはqooxdoo demobrowserビューのテストと似ています)?古い仮想ツリー・インプリメンテーション(qx.ui.treevirtual.TreeVirtual)を使用しているqooxdoo仮想ツリーをメニューとして

_createLayout : function() 
    { 
     // Create main layout 
     var dockLayout = new qx.ui.layout.Dock(); 
     var dockLayoutComposite = new qx.ui.container.Composite(dockLayout); 
     this.getRoot().add(dockLayoutComposite, {edge:0}); 

     // Create header 
     this.__header = new bank.view.Header(); 
     dockLayoutComposite.add(this.__header, {edge: "north"}); 

     // Create toolbar 
     this.__toolBarView = new bank.view.ToolBar(this); 
     dockLayoutComposite.add(this.__toolBarView, {edge: "north"}); 

     // Create the tree view, which should create dockLayout below, when user clicks with Row value 
     dockLayoutComposite.add(this.getTreeView(), {edge: "west"}); 
     // This layout should be created and recreated with clicked row value 
    dockLayoutComposite.add(bank.InvoiceListBuilder.createList("Tree_returned_value"), {edge: "center"}); 
    }, 

getTreeView : function() 
    { 
     var hBox = new qx.ui.container.Composite(new qx.ui.layout.HBox(20)); 
     var tree = new qx.ui.treevirtual.TreeVirtual("Tree"); 
     tree.setColumnWidth(0, 170); 
     tree.setAlwaysShowOpenCloseSymbol(true); 
     var dataModel = tree.getDataModel(); 
     var te2 = dataModel.addBranch(null, "Folders", true); 
     dataModel.addBranch(te2, "Incoming", false); 
     dataModel.addBranch(te2, "Outgoing", false); 
     dataModel.addBranch(te2, "Drafts", false); 
     dataModel.setData(); 
     hBox.add(tree); 
     var foldercontent = bank.InvoiceListBuilder.createList("incoming"); 
     tree.addListener("changeSelection", 
      function(e) 
      { 
      // this function should return row value to function: bank.InvoiceListBuilder.createList("Tree_returned_value") and create/recreate dockLayout with newly created widget from bank.InvoiceListBuilder.createList function 
      }); 
     return hBox; 
    }, 

答えて

1

、私はqx.ui.tree.VirtualTree実装を使用することをお勧め。

次のステップでは、ビューのコントローラーのようなものを使用して、選択内容をリッスンし、選択が変更されたときにウィジェットを作成します。コントローラは、ウィジェットを追加するためのコンテナを知っている必要があります。

あなたの左側は単なるリストです。仮想リスト(qx.ui.list.List)を使用して、ツリーモデルのセットを使用することもできます。

乾杯、 クリス

関連する問題