i am exploring the tab components in primefaces http://www.primefaces.org/showcase/ui/tabviewChangeListener.jsf , and i was wondering if it's possible to invoke a JavaScript when a specific tab is being clicked.
please advise, thanks.
i am exploring the tab components in primefaces http://www.primefaces.org/showcase/ui/tabviewChangeListener.jsf , and i was wondering if it's possible to invoke a JavaScript when a specific tab is being clicked.
please advise, thanks.
有两种方法可以连接选项卡更改事件:
使用标签的onTabChange
属性<p:tabView>
对相应的事件执行回调函数:
<p:tabView onTabChange="handleTabChange(index)">
//tabs
</p:tabView>
当 AJAX 调用成功完成时,使用标签的oncomplete
属性<p:ajax>
执行 JS 函数:
<p:ajax event="tabChange" listener="#{tabBean.onTabChange}" oncomplete="handleOncomplete(xhr, status, args)"/>