0
votes

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.

1

1 Answers

0
votes

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