I have a dialogue with a commandButton, and this is what I'm trying to do:
This is the code I'm using:
<p:commandButton value="Submit"
action="<some java work>"
oncomplete="dialogue.hide(); sideTabs.select(1)"
update="<update side tab">
</p:commandButton>
The problem is, this only works once between refreshes. What I mean is, I click the button, and everything works fine-the tab changes to the requested tab, the tab is updated, and the dialogue disappears. But when I click the button again, the requested tab is indeed selected, but isn't properly refreshed until I hit f5. Once I do that, I can click the dialogue button again and the tab will properly refresh again, but once again, only once - until I hit f5 again. So, something like this:
Does anyone have an idea why this is happening? Do I need to add some page refresh mechanism to my commandButton? If so, how is this done? Thanks!!!
I've tried to replicate the problem with no success.
Here is a the attribute from my ViewScoped bean:
private String str1 = "a";
private String str2 = "b";
private String update = ":f:t";
private Integer index = 0;
And here is the view:
<h:form id="f">
<p:tabView id="t" widgetVar="tVar" activeIndex="#{viewMBean.index}" >
<p:tab id="a" title="A" >
#{viewMBean.str1}
</p:tab>
<p:tab id="b" title="B">
#{viewMBean.str2}
</p:tab>
</p:tabView>
</h:form>
<p:dialog id="d" widgetVar="dVar">
<h:form>
<p:inputText value="#{viewMBean.str1}" />
<br />
<p:inputText value="#{viewMBean.str2}" />
<br />
<p:inputText value="#{viewMBean.update}" />
<br />
<p:inputText value="#{viewMBean.index}" />
<br />
<p:commandButton value="Submit" update="#{viewMBean.update}" oncomplete="dVar.hide();" />
</h:form>
</p:dialog>
I believe the problem is somewhere else in your code.