-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I would like to execute a javascript function every time a component becomes visible. I have tries zk.afterMount, but this only gets triggered once. When visibility of the component changes (in a tab switch) the function is not triggered when the tab is opned again. Is there some other hook to accomplish this?
B.
Please refer to Client-side Reference about responding to client-side activity. onShow
is called after the widget becomes visible.
Below is a simple example that will alert each time the window becomes visible again.
<zk>
<script defer="true">
var oldWindow = zul.wnd.Window.prototype;
zk.override(zul.wnd.Window.prototype, oldWindow, {
onShow: function(ctl) {
alert('Window becomes visible');
}
});
</script>
<tabbox>
<tabs>
<tab>Tab 1</tab>
<tab>Tab 2</tab>
</tabs>
<tabpanels>
<tabpanel>
<window title="test" border="normal">
Main Window
</window>
</tabpanel>
<tabpanel>
</tabpanel>
</tabpanels>
</tabbox>
</zk>
Asked: 2013-01-16 07:26:52 +0800
Seen: 49 times
Last updated: Jan 22 '13