Hello,
we have a big problem here with several primeface components (version 5.2.3) (e.g. selectBooleanCheckbox, selectOneMenu...). If you put these on tabs of a tabView component they lose their values when the form containing the tabView is being updated (e.g. via a commandButton). This only happens when the tabView is set to dynamic. Other components like inputText e.g. don't lose their values, though. This phenomenon also only show on tabs that aren't active/visible while updating the form. In our real world scenario both the update on the form and the tabView set to dynamic are necessary for several reasons.
To cut a long story short - here's a short example
xhtml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Update issue Example!!!</title>
</h:head>
<h:body>
<h3>Issue example application</h3>
<h:form id="updateIssueDemo">
<p:tabView dynamic="true" cache="false" id="tab">
<p:tab title="Tabview-Tab No. 1" id="tab1">
<h:outputText value="inputText:" />
<h:inputText value="#{sampleModel.sampleText}" />
</p:tab>
<p:tab title="Tabview-Tab No. 2" id="tab2">
<h:outputText value="selectBooleanCheckbox" />
<p:selectBooleanCheckbox value="#{sampleModel.checkboxValue}" />
</p:tab>
<p:tab title="Tabview-Tab No. 3" id="tab3">
<h:outputText value="select" />
<p:selectOneMenu value="#{sampleModel.selectedItem}">
<f:selectItems value="#{sampleModel.selectItems}" />
</p:selectOneMenu>
</p:tab>
</p:tabView>
<p:commandButton value="Save data" action="#{sampleController.saveData}" update="updateIssueDemo" />
</h:form>
</h:body>
</html>
controller:
@ManagedBean
@RequestScoped
public class SampleController {
private static final Log LOG = LogFactory.getLog(SampleController.class);
@ManagedProperty(value = "#{sampleModel}")
private SampleModel model;
public void doBusinessLogic() {
LOG.info("method doBusinessLogic called");
}
public SampleModel getModel() {
return model;
}
public void setModel(SampleModel model) {
this.model = model;
}
public void saveData() {
LOG.info("!saved data -> text:" + model.getSampleText() + " selectedItem:" + model.getSelectedItem() + " checkbox:" + model.getCheckboxValue());
}
}
model:
@ManagedBean
@SessionScoped
public class SampleModel implements Serializable {
private String sampleText;
private Boolean checkboxValue;
@SuppressWarnings("unused")
private List<SelectItem> selectItems;
private String selectedItem;
public String getSampleText() {
return sampleText;
}
public void setSampleText(String sampleText) {
this.sampleText = sampleText;
}
public Boolean getCheckboxValue() {
return checkboxValue;
}
public void setCheckboxValue(Boolean checkboxValue) {
this.checkboxValue = checkboxValue;
}
public List<SelectItem> getSelectItems() {
List<SelectItem> testSelectItems = new ArrayList<SelectItem>();
testSelectItems.add(new SelectItem("A"));
testSelectItems.add(new SelectItem("B"));
testSelectItems.add(new SelectItem("C"));
return testSelectItems;
}
public void setSelectItems(List<SelectItem> selectItems) {
this.selectItems = selectItems;
}
public String getSelectedItem() {
return selectedItem;
}
public void setSelectedItem(String selectedItem) {
this.selectedItem = selectedItem;
}
}
Please fix this issue!
Why have you closed this, is issue resolved? I'm not sure how this could happen as we don't process children on inactive components in dynamic mode.
I am experiencing a similar problem with a selectOneMenu inside of a rowExpansion. When the row is collapsed, and pagination is performed, values for a calendar and a textArea are kept but the value for a selectOneMenu is lost (actually, the setter of the value variable is called setting it to null). When you expand again the row, the value is gone. Could it be related?
We have large screens with a lot of data on them. We would like to use dynamic tabs so that we could load the data of the tabs on request. This will increase the performance of the initial screen response time a lot. Unfortunately this bug makes the feature unusable for us.
Why was it closed?
Could you please have a look at it?
Most helpful comment
Why have you closed this, is issue resolved? I'm not sure how this could happen as we don't process children on inactive components in dynamic mode.