Question

I have a toolBar where i am using plenty of item now when i am clicking on any item i am creating a tab.Something like this code

public static void openNewTab(String title, String path, Tabbox mainTab) {
    Tab tab = new Tab(title);
    tab.setClosable(true);
    tab.setParent(mainTab.getTabs());
    Tabpanel tabpanel = new Tabpanel();
    Include include = new Include(path);
    include.setParent(tabpanel);
    tabpanel.setParent(mainTab.getTabpanels());
    mainTab.setSelectedTab(tab);
}

Now i will want to get the ViewModel of selected tab When any Ctrl Key press in ZUL... I have this

@Wire("#mainTab")
Tabbox mainTab;
   Tab tab = mainTab.getSelectedTab( );

Can it possible to get ViewModel from the selectedTab varaibles?

And i am doing like this

Include include = new Include(path);
include.setParent(tabpanel);
Object object = include.getAttribute("viewModel");

Now object is giving null Can we get ViewModel from here while i am including a ZUl here?

Was it helpful?

Solution

It seems the id is the attribute name to get vm, see sample at zkfiddle

Btw "binder" is the attribute name to get binder, for more information please refer to Source code of binder

You can also try to use Component.getAttributes to get the attribute map and check all attributes in it, see Javadoc: Component#getAttributes

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top