Hi optimus.prime
You said PrimeFaces 5.1.9 and above should support cellEditEvent with dynamic columns. I had the same issue with 5.2.0, newvalue and oldvalue are null.
Is it being supported in a Elite version only or should be working in Community version as well?
In Cell Editing for dynamic columns
-
- Posts: 1
- Joined: 04 Jan 2017, 14:17
Hi, I am also hitting same issue with 6.0. Can any body help me on this.
Thanks a lot for this it really help me!
Currently
JSF 2.2
Primefaces 6.2
The datatable + c:for each (with column inside) didn't work for me, I had to use the columns element inside the datatable not including the cell edit p:ajax instead of that i included a p:ajax event blux on the input field and now it works.
I wanted to add the code to show the example but its in work office and the security it's very high to share anything and looks something like this
<p:datatable value {general bean } var = D0>
<column>
<p:datatable value= {D0.list<list<string>> property}> var =D1 >
<columns value={bean with the index> var D2 >
<f:facet name="output">
<h:outputText value="#{D1[D2]}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{D1[D2]}" />
<p:ajax event=blur actionListener=(bean.keyuphandler()} />
</f:facet>
<columns />
<p:datatable/>
<column>
<p:datatable/>
Thanks a lot again!
Currently
JSF 2.2
Primefaces 6.2
The datatable + c:for each (with column inside) didn't work for me, I had to use the columns element inside the datatable not including the cell edit p:ajax instead of that i included a p:ajax event blux on the input field and now it works.
I wanted to add the code to show the example but its in work office and the security it's very high to share anything and looks something like this
<p:datatable value {general bean } var = D0>
<column>
<p:datatable value= {D0.list<list<string>> property}> var =D1 >
<columns value={bean with the index> var D2 >
<f:facet name="output">
<h:outputText value="#{D1[D2]}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{D1[D2]}" />
<p:ajax event=blur actionListener=(bean.keyuphandler()} />
</f:facet>
<columns />
<p:datatable/>
<column>
<p:datatable/>
Thanks a lot again!
adw3345 wrote: ↑22 Dec 2013, 23:28Ok I successfully figured out my dymanic column problem. I used Tosh's example to make my own:
The absolute important thing to make this work at all is that the getGradebook() function in this example must only be created once upon construction.Code: Select all
<p:dataTable value="#{ityteacher.gradebook.columnValues}" var="columnValues" id="currentGrades" tableStyle="table-layout:auto" editable="true" editMode="cell" widgetVar="gradeBook" scrollable="true"> <p:ajax event="cellEdit" listener="#{ityteacher.onGradeCellEdit}" /> <c:forEach items="#{ityteacher.gradebook.columnNames}" var="column" varStatus="colLoopStatus"> <p:column headerText="#{column}"> <p:cellEditor> <f:facet name="output"> <h:outputText value="#{columnValues[colLoopStatus.index]}" /> </f:facet> <f:facet name="input"> <p:inputText value="#{columnValues[colLoopStatus.index]}" /> </f:facet> </p:cellEditor> </p:column> </c:forEach> </p:dataTable>
So I needed to do this:
If you keep regenerating the gradeBook values, the "new" and "old" values will always be 'null'.Code: Select all
public GradeBook getGradebook(){ if(gradeBook==null){ ........ } return gradeBook; }
Also one peice of trivia, you can get the row of the value changed easily through
But if you want to get the column that changed, you find out through the column header:Code: Select all
public void onGradeCellEdit(CellEditEvent event) { int row = event.getRowIndex(); }
So when a change is made, you'll have this information:Code: Select all
public void onGradeCellEdit(CellEditEvent event) { String column = event.getColumn().getHeaderText(); }
Old value
New value
Numeric Row indicator
Header string of column
Here is the structure for "Gradebook" as shown above, FYI:
-DerrickCode: Select all
public class GradeBook { List<String> columnNames; List<List<String>> columnValues; public List<String> getColumnNames() { return columnNames; } public void setColumnNames(List<String> columnNames) { this.columnNames = columnNames; } public List<List<String>> getColumnValues() { return columnValues; } public void setColumnValues(List<List<String>> columnValues) { this.columnValues = columnValues; } }
-
- Information
-
Who is online
Users browsing this forum: No registered users and 44 guests