question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynaform: Component attribute does not work with datatable

See original GitHub issue

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;
	}

}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:22 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
mellowarecommented, May 30, 2022

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

0reactions
mellowarecommented, Jun 29, 2022

I have also confirmed this is now fixed in Mojarra 2.3.18 and 4.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

3.0 - 3.7 - Dynaform Do's and Dont's - ProcessMaker Wiki
It is the component in charge of creating controls, building the responsive layout and connecting services to gather and handle form data. Architectural...
Read more >
Using advanced data table features | Apache MyFaces 1.2 ...
In this case, the <t:dataTable> component will make every column in the table sortable. Unfortunately, this feature does not work if a Facelets...
Read more >
dataTables HTML5 data-search cell attribute does not work
The HTML5 data-* attributes works if all cells in a column have the data-* attribute at the time the table is initialised. You...
Read more >
Add validators in dynaform components - PrimeFaces forum
I can get validator rule name in outputText but when I set disabled=false in <f:validator > then I'm getting error : "javax.servlet.
Read more >
Column width not working — DataTables forums
Hi I have read the other posts in the forum. Did not find solution.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found