primefaces-extensions: Dynaform: Component attribute does not work with datatable

Describe the bug Use a component for dynaFormControl of Dynaform, that component has attributes and a datatable. Those attributes resolved to empty values although we pass non-empty values to those attributes.

Reproducer A sample project is at https://github.com/lttung04/dynaform-with-datatable

Environment:

  • PF Version: 11.0.0

To Reproduce Steps to reproduce the behavior:

  1. Go to your deployed application, e.g. http://localhost:8080/primefaces-test/
  2. Cannot see a table image

NOTE Look at the sample code, you could see <h:outputText value=“#{cc.attrs.nameColumnRendered}” />, but #{cc.attrs.nameColumnRendered} is resolved to empty value.

Expected behavior See a table with one row

Sample XHTML File dynaform.xhtml

<h:form id="form">
	<local:DocumentContainer />
</h:form>

File DocumentContainer.xhtml

<cc:interface>
</cc:interface>
<cc:implementation>
	<pe:dynaForm id="dyna-form" value="#{dynaFormController.model}" var="dynaData">
		<pe:dynaFormControl type="FileUpload" for="fileUpload">
			<local:DocumentTable id="fileUpload" notInDynaform="true" nameColumnRendered="true" />
		</pe:dynaFormControl>
	</pe:dynaForm>
</cc:implementation>

File DocumentTable.xhtml

<cc:interface>
	<cc:attribute name="nameColumnRendered" default="true" />
	<cc:attribute name="notInDynaform" default="true" />
</cc:interface>
<cc:implementation>
	<cc:renderFacet name="componentHeader" />
	<p:dataTable id="document-table" value="#{dynaFormController.documents}" var="document"
		style="border:solid; border-width:1px">
		<p:column headerText="Name" rendered="#{cc.attrs.nameColumnRendered}">
			<h:outputText id="name" value="#{document}" title="#{document}" />
		</p:column>
	</p:dataTable>
	<h:outputText value="#{cc.attrs.nameColumnRendered}" />
	<cc:renderFacet name="componentFooter" rendered="#{cc.attrs.notInDynaform}" />
</cc:implementation>

Sample Bean

@ManagedBean
@ViewScoped
public class DynaFormController implements Serializable {

	private static final long serialVersionUID = 1L;
	private DynaFormModel model;
	private List<String> documents;

	public DynaFormController() {
		model = new DynaFormModel();
		documents = new ArrayList<>();
		documents.add("First doc");
		DynaFormRow row = model.createRegularRow();
		row.addControl(row, "FileUpload");
	}

	public DynaFormModel getModel() {
		return model;
	}

	public void setModel(DynaFormModel model) {
		this.model = model;
	}

	public List<String> getDocuments() {
		return documents;
	}

	public void setDocuments(List<String> documents) {
		this.documents = documents;
	}

}

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (15 by maintainers)

Most upvoted comments

That is great to hear! I posted on the MyFaces users list asking for a release: https://lists.apache.org/list.html?users@myfaces.apache.org