Note that there are some explanatory texts on larger screens.

plurals
  1. POSmartGWT: How to create a tab in a pane dynamically by clicking a tree node in another pane
    primarykey
    data
    text
    <p>I'm new to smartGWT. I saw a tutorial in the following link <a href="http://www.javacodegeeks.com/2011/01/advanced-smartgwt-tutorial-part-2.html" rel="nofollow">http://www.javacodegeeks.com/2011/01/advanced-smartgwt-tutorial-part-2.html</a></p> <p>Here there are two classes one is main area and another is navigation area. Navigation area contains tree nodes . When i click tree node it displays a popup , but i want to create a tab with click event of a node. </p> <p>I tried in the following way but it didn't work . I think it added the tabs since the mainarea is already got loaded it is not taking any effect</p> <p>Main Area Class has this code:</p> <pre><code>public class MainArea extends SectionStack { final TabSet topTabSet = new TabSet(); public static MainArea mainareaobj; public static MainArea getInstance() { if(mainareaobj==null) { mainareaobj=new MainArea(); } return mainareaobj; } public MainArea() { super(); this.setOverflow(Overflow.AUTO); topTabSet.setTabBarPosition(Side.TOP); topTabSet.setTabBarAlign(Side.LEFT); SectionStackSection section2 = new SectionStackSection("TabSection2"); section2.setExpanded(true); section2.addItem(topTabSet); this.addSection(section2); } </code></pre> <p>Following code is of navigation grid</p> <pre><code>public class NavigationTreeGrid extends TreeGrid { public String scenario_Name; public Tab scenarioTab; MainArea obj=MainArea.getInstance(); public NavigationTreeGrid() { setShowOpenIcons(false); setShowDropIcons(false); setShowSelectedStyle(true); setShowPartialSelection(true); setCascadeSelection(false); setCanSort(false); setShowConnectors(true); setShowHeader(false); setLoadDataOnDemand(false); setSelectionType(SelectionStyle.SINGLE); Tree data = new Tree(); data.setModelType(TreeModelType.CHILDREN); data.setRoot( new TreeNode("root", new TreeNode("rootNode", new TreeNode("Node1"), new TreeNode("Node2"),new TreeNode("Node3"),new TreeNode("Node4"),new TreeNode("Node5"))) ); setData(data); addNodeClickHandler(new NodeClickHandler() { @Override public void onNodeClick(NodeClickEvent event) { scenario_Name = event.getNode().getName(); obj.topTabSet.addTab(createTab(scenario_Name)); } }); } public Tab createTab(String tabName) { scenarioTab=new Tab(tabName); scenarioTab.setCanClose(true); //scenarioTab.setWidth(300); return scenarioTab; } </code></pre> <p>can any plz help me</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload