We are using AjaxTabbedPanel to display data. We don't want to pre-load all
the data at star up. We want to load the tab's content when user clicks on
the tab. So, we decided to use AjaxTabbedPanel. We are using AbstractTab.
Each tab represents a category, so we hold the category id on the tab panel.
public class MyAjaxTabbedPanel extends AjaxTabbedPanel {
private String name; // this is the ajaxtabpanel name
List tabs; // this holds the list of tabs
public MyAjaxTabbedPanel (String id, String nameTag, List tabsList) {
super(id, tabsList);
name = nameTag;
tabs = tabsList;
}
protected void onAjaxUpdate(wicket.ajax.AjaxRequestTarget target) {
AbstractTab selectedTab = (AbstractTab)
tabs.get(getSelectedTab());
// took me a while to figure out that 'panel' is hardcoded
as the panel id
MyTabPanel tabPanel = (MyTabPanel )
selectedTab.getPanel("panel");
// data from service layer
List newTabList =
MyService.getSomethingBasedOnCategoryId(tabPanel.getCategoryId());
// remove existing components; otherwise, complain about wicket:id
already exists
// add new one
tabPanel.removeComponents();
tabPanel.addComponents(newTabList);
// refresh the component
target.addComponent(this);
}
}
The above code will run w/o errors, but UI doesn't refresh. I'm suspecting
i'm not refreshing the correct component. As you can see, the components
are added on the MyTabPanel class. I appreciate if someone could point me
to the right direction of show me some examples on how to dynamically update
tabs content.
--
View this message in context:
http://www.nabble.com/How-to-update-AjaxTabbedPanel-tab-with-new-data-tf3800175.html#a10751584
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user