I have 2 strange behaviors of the cellEditor component if I use a inputTextArea (in the input facet) that has a complete method (with the last PF snapshot and also with 5.0 CE ).
This is the situation:
If I edit the cell in the datatable and (without pressing enter) I click a commandButton (outside the table) to refresh the datatable the cell is not updated and the value stored is the id of the inputTextArea component (ex: form:celleditor:0:j_idt35).
1) This problem (value with the ID) occur only if the textArea has a complete method (a second click on the button will show the ID also in the output facet).
2) The update of the cell (pressing a button outside the table) is always present (general problem).
Test Bean:
Code: Select all
@SessionScoped
public class TestBean implements Serializable {
private List<User> users = new LinkedList<User>();
public TestBean() {
users.add(new User("user1", ""));
users.add(new User("user2", ""));
users.add(new User("user3", ""));
}
public List<String> complete(String query) {
return new LinkedList<String>(); // just an example
}
public List<User> getUsers() {
return users;
}
public void setUsers(List<User> users) {
this.users = users;
}
}
Code: Select all
public class User implements Serializable {
private String name;
private String pwd;
public User(String name, String pwd) {
this.name = name;
this.pwd = pwd;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
}
Code: Select all
<h:form id="form">
<p:commandButton value="Test" process="celleditor" update="celleditor"/>
<p:dataTable id="celleditor" value="#{test.users}" var="user" rowIndexVar="idx" editable="true" editMode="cell">
<p:column headerText="Rows">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{user.name}"/>
</f:facet>
<f:facet name="input">
<p:inputTextarea value="#{user.name}" completeMethod="#{test.complete}" minQueryLength="1" maxlength="40000"/>
</f:facet>
</p:cellEditor>
</p:column>
</p:dataTable>
</h:form>
the problem 2) (I think) occur because the event cellEdit is not fired when clicking a button outside the table (I also tried to verify it with a p:ajax cellEdit event: not fired...).
Any advice?
Thank you,
Roberto