wrong DataTable selection_checkbox render

UI Components for JSF
Post Reply
cadorca
Posts: 4
Joined: 09 Jan 2011, 03:23

11 Sep 2011, 23:08

I created a DataTable that enable multiple selection with checkbox when i submit the form the selection event method is not called, if i select all the rows with the header checkbox it works, after some investigation i founded that is rendering the same name for all checkboxes and not an unique like in the showcase, how can i get this to work?

Image

This is the my code:

Code: Select all

  <h:form id="frmView" >
            <p:dataTable id="tblData" rows="60"  resizableColumns="true" scrollHeight="600" selectionMode="multiple" scrollable="true"   value="#{newClass.model}" lazy="true"  widgetVar="tblData" selection="#{newClass.selecteds}" var="cr">
                <p:column selectionMode="multiple" /> 

                <p:column headerText="Id Area"  filterBy="#{cr.idAlumno}" style="width: 100px"  >
                    #{cr.idAlumno}
                </p:column> 
                <p:column headerText="Cod Area"  filterBy="#{cr.apellidos}" style="width: 100px">
                    #{cr.apellidos}
                </p:column>
                <p:column headerText="Desc Area"  filterBy="#{cr.nombres}" style="width: 150px">
                    #{cr.nombres}
                </p:column>
                <f:facet name="footer">
                    <p:commandButton value="Hello from PrimeFaces" action="#{newClass.crear}"  oncomplete="dlgEdit.show();"  />
                </f:facet>
                <p:ajax event="rowSelect" onstart="dlgEdit.show()" listener="#{newClass.selectEvent}"   
                        update="frmEdit:inpCodArea,frmEdit:inpDescArea" oncomplete="dlgEdit.show()" />   

            </p:dataTable>
        </h:form>
This is my lazy model

Code: Select all

public class AlumnosDataModel extends LazyDataModel<Alumnos> {

    private PersistenceBean persistenceBean;

    public AlumnosDataModel(PersistenceBean persistenceBean) {
        this.persistenceBean = persistenceBean;
    }
    
    @Override
    public Object getRowKey(Alumnos object) {
        return object.getIdAlumno();
    }

    @Override
    public Alumnos getRowData(String rowKey) {
        System.out.print("key"+rowKey);
        return (Alumnos) persistenceBean.get("Alumnos.findAllitem", new Integer(rowKey));
    }
    
    @Override
    public List<Alumnos> load(int i, int i1, String string, SortOrder so, Map<String, String> map) {
        return  persistenceBean.list("Alumnos.findAlli", i, i1);
    }

    @Override
    public int getRowCount() {
        return 50;
    }
    
    
    
}
PrimeFaces-3.0.RC1
Glassfish 3.3

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 49 guests