tags:

views:

7

answers:

1

Hi, this is my sample code. I have a total of 3 ListGrids, each which resides in a Canvas, inside 3 tabs, which is inside one TabSet. If I remove the uncommented lines, I cant select any values, because on every click, the ListGrid is populated.

tab.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (tab.getSelectedTab() == allUsers) {
                //adminService.getAllUsers(getAllUsersAsync);
            } else if (tab.getSelectedTab() == activeUsers) {
                //adminService.getActiveUsers(getActiveUsers);
            } else if (tab.getSelectedTab() == inactiveUsers) {
                //adminService.getInactiveUsers(getInActiveUsers);
            }
        }
    });

I want to fill the ListGrid with data from results of a DB query, when I select a tab. How to fill data in the ListGrid when I change the tab?

Thanks.

A: 

Yeah, i know, its lame to find your own answer within minutes. I guess SO clears the mind.

tab.addTabSelectedHandler(new TabSelectedHandler() {

            @Override
            public void onTabSelected(TabSelectedEvent event) {
                if (tab.getSelectedTab() == allUsers) {
                    applyButton.setDisabled(true);
                    adminService.getAllUsers(getAllUsersCallback);

                } else if (tab.getSelectedTab() == activeUsers) {
                    applyButton.setDisabled(false);
                    applyButton.setTitle("Set Inactive");
                    adminService.getActiveUsers(getActiveUsersCallback);

                } else if (tab.getSelectedTab() == inactiveUsers) {
                    applyButton.setDisabled(false);
                    applyButton.setTitle("Set Active");
                    adminService.getInactiveUsers(getInActiveUsersCallback);
                }

            }
        });

is what I did.

Kaustubh P