I am now trying the dataTable features and I have a few questions.
Let me show what I am doing:
The UserBean
<h:form id="userListForm" prependId="false">
<p:dataTable id="userList" value="#{userBean.users}" var="u" paginator="true" rows="10" width="100%"
selection="#{userBean.selectedUsers}" selectionMode="single" update="userForm" rendered="#{not empty userBean.users}">
<p:column resizable="true" sortable="true">
<f:facet name="header">
<h:outputText value="#{msg['user.name']}" />
</f:facet>
<h:outputText value="#{u.name}" />
</p:column>
</p:dataTable>
</h:form>
Code: Select all
@Name("userBean")
public class UserBean implements Serializable {
private static final long serialVersionUID = 1L;
@Out
private List<User> users;
private Object[] selectedUsers;
//getters and setters...
1. I dont understand why the selectionMode="single" makes me set the selection attribute value to a primitive array of objects. Please excuse me to suggest another way to handle this. When using selectionMode="single", I think it would be better to allow the selection attribute value to be set to a single instance of any other type like a pojo class User.java, or even when using selectionMode="multiple", to a collection of users instead of a primitive array of users.
2. There are two attributes being ignored in here: dataTable width and column sortable.
3. Is already there a way to align an specific column header and/or body to the right?
Feedbacks about any of the issues above will be helpful
Thanks
WM