0

refresh data when using a tab

asked 2008-09-25 03:03:51 +0800

ibsolution gravatar image ibsolution
468 1 1 6

hai,

i have a page that contain tab component. inside tabpanel i use include component to handle the data.

How to refresh a data when user click tab caption one and the other, my problem i am using 4 differrent class to handle the data from different tab

zul.file

	<tabbox width="100%">
		<tabs sclass="menutitle">
			<tab onClick="lockertranswindow.onUpdateTitle(in.getId())" id="in" label="In" width="25%" sclass="menutitle" />
			<tab id="out" label="Out" width="25%" sclass="menutitle" />
			<tab id="list" label="List" width="25%" sclass="menutitle" />
			<tab id="inq" label="Inquery" width="25%"
				sclass="menutitle" />
		</tabs>
		<tabpanels>
			<tabpanel>
				<include src="/forms/display/spa/locker/lockerin.zul" />
			</tabpanel>
			<tabpanel fulfill="out.onSelect">
				<include src="/forms/display/spa/locker/lockerout.zul" />
			</tabpanel>
			<tabpanel fulfill="list.onSelect">
				<include
					src="/forms/display/spa/locker/lockerreprint.zul" />
			</tabpanel>
			<tabpanel fulfill="inq.onSelect">
				<include src="/forms/display/spa/locker/inqueary.zul" />
			</tabpanel>
		</tabpanels>
	</tabbox>


TIA,

andy susanto

delete flag offensive retag edit

8 Replies

Sort by ยป oldest newest

answered 2008-09-25 09:40:14 +0800

flyworld gravatar image flyworld
155 3

refresh some components you can use

invalidate()

link publish delete flag offensive edit

answered 2008-09-26 01:35:49 +0800

ibsolution gravatar image ibsolution
468 1 1 6

hai,

oke if that the function to use invalidate();

but how i can implement that funtion in my code.

because when you see in my zul file, i show the data with include component.

if i am not wrong, i just use id of include component after that the data will refresh, am i right ?


TIA,

Andy Susanto

link publish delete flag offensive edit

answered 2008-09-26 02:02:20 +0800

flyworld gravatar image flyworld
155 3

yes , you can use component id.invalidate();
in your case , you can give tabpanel or your zul file an id then invalidate() it;

link publish delete flag offensive edit

answered 2008-09-26 15:12:26 +0800

ibsolution gravatar image ibsolution
468 1 1 6

hai,

how can i invalidate when user click Tab ?

if i put invalidate in tabpanel user does not know.

TIA,

Andy Susanto

link publish delete flag offensive edit

answered 2008-09-27 11:27:00 +0800

BMInfo gravatar image BMInfo
48

Hi.

Try this:

  EventListener myTabOnSelect = new EventListener() {
    public void onEvent(Event myEvent) {
      //
      // my Refresh Code ...
      //
    }
  };

  myTab.addEventListener("onSelect",myTabOnSelect);

link publish delete flag offensive edit

answered 2008-09-27 16:23:43 +0800

ibsolution gravatar image ibsolution
468 1 1 6

hai BMInfo,

Thanks your post solve my problem. Now every time user click the tab user always get a new data


Regards,

Andy Susanto

link publish delete flag offensive edit

answered 2010-08-15 16:00:40 +0800

gorax246 gravatar image gorax246
9

Hey ibsolution,
as the solution provided to u by BMInfo solved ur problem...I'm facing the same problem and i wonder as to where u've added the code he's specified.

Another problem to which m clueless for quite a while...
I have a home.zul file that has a tab structure...And each tab structure loads another separate zul file.
I have a label on the home.zul file that should help me navigate to a specific zul file within a specific tab...the href attribute wont work for me as i have to not to load only the selected zul file but also show the zul file being loaded in the tab

SOS,
Gaurav

link publish delete flag offensive edit

answered 2015-06-26 15:39:19 +0800

WilliamB gravatar image WilliamB
1609 1 6

updated 2015-06-29 09:23:28 +0800

Using MVVM, I needed that some tabs refresh on select while other did not.

I made a custom component extending Tab

public class ConfirmedTab extends Tab {
    private static final long serialVersionUID = 1L;

    private boolean refreshOnSelect;

    @Override
    public void setSelected(final boolean pSelected) {
        if (pSelected && refreshOnSelect) {
            ((Tabbox) this.getParent().getParent()).getSelectedPanel().getChildren().get(0).invalidate();
        }
        super.setSelected(pSelected);
    }

    public void setRefreshOnSelect(final boolean pRefreshOnSelect) {
        refreshOnSelect = pRefreshOnSelect;
    }
}
link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2008-09-25 03:03:51 +0800

Seen: 1,050 times

Last updated: Jun 29 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More