开发者

GWT - refreshing a tab panel

I have a tabpanel with 3 tabs. One of the tabs has a table which draws a table with data from the database. But if new data is entered, after I select the tab I have to refresh the browser page to see the update. I've added the following selection handler to the tabpanel:

tabpanel.addSelectionHandler(new SelectionHandler<Integer>() 
        {
            public void onSelection(SelectionEvent<Integer> event) 
            {
                int tabId = event.getSelectedItem();
      开发者_开发百科          Widget tabWidget = tabpanel.getWidget(tabId);
                if (tabWidget != null) 
                {
                    //assumming that code to refresh will go here...
                }
            }
        });

What can I do so that when a certain tab is selected then that tab will refresh?

Thanks so much in advance.


What you have done is correct. Just put your data access code in the commented area. So for example

            int tabId = event.getSelectedItem();
            // PSEUDO CODE
            data = AsyncCallback.getData()
            tabPanel.setWidget(tabId, new Widget(data)); // PSEUDO CODE
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜