我有以下情况:
有一个JSF页面:
<h:form id="form">
<!-- MENU SHOULD GOES HERE -->
<p:commandButton action="#{bean.sched.addWeek}" value="Add week" update="weeksTab" />
<p:tabView id="weeksTab" value="#{bean.sched.weekList}" var="week" >
<p:tab title="#{week.name}" >
<!-- THIS BUTTONS SHOULD BE IN MENU -->
<p:commandButton action="#{week.addDay}" value="Add day" update="weeksTab" />
<p:commandButton action="#{bean.sched.removeWeek(week)}" value="Remove week" update="weeksTab" />
<p:tabView id="daysTab" value="#{week.dayList}" var="day" >
<p:tab title="#{day.name}">
<!-- THIS BUTTON SHOULD BE IN MENU -->
<p:commandButton action="#{week.removeDay(day)}" value="Remove day" update="weeksTab" />
<!-- PROCESSING DAY : ADDING MEETINGS, ROUTINES ETC.
THOSE FUNCTIONS SHOULD BE ALSO AVAILABLE
IN MENU -->
</p:tab>
</p:tabView>
</p:tab>
</p:tabView>
我想将所有操作控件(例如添加/删除/编辑周、天和用户的每日活动按钮)放在页面顶部的菜单中。问题是如何传递给 p:tabView 内部管理的外部标签变量?有可能吗?我在 h:form 中添加这样的东西:
<p:toolbar>
<p:toolbarGroup align="left">
<p:commandButton
onclick="jQuery('#hiddenAddWeekButton').click();return false;"
value="Add week" icon="ui-icon-circle-plus" ajax="false" />
</p:toolbarGroup>
</p:toolbar>
<p:commandButton id="hiddenAddWeekButton"
action="#{bean.sched.addWeek}" value="add week"
update="weeksTab" style="display:none" />
但它仍然无法正常工作..