DataTable <p:column selection="multiple"/> alway null

UI Components for JSF
Post Reply
alexone
Posts: 2
Joined: 13 Aug 2018, 20:57

13 Aug 2018, 21:02

Hi eveyone

I have this:

<p:dataTable id="tabla" var="tbl" value="#{rptListadoSMSController.campanasList}"
selection="#{rptListadoSMSController.selectedCampanas}"
rowKey="#{tbl.id}" style="margin-bottom:0" >
<p:column selectionMode="multiple" style="width:16px;text-align:center"/>
<p:column headerText="Descripción">
<h:outputText value="#{tbl.descripcion}" />
</p:column>
<p:column headerText="Desde">
<h:outputText value="#{tbl.dias}"/>
</p:column>
<p:column headerText="Hasta">
<h:outputText value="#{tbl.diasHasta}"/>
</p:column>
</p:dataTable>
But in my backen bean selectedCampanas is always null

What's wrong??? I missing something??? The strange is I have the same code in other xml and other bean and work fine, I copy and paste the code from the bean and xml thats working and still null.

Please help anyone???

Thanks a lot !!!!

huseyinT
Posts: 123
Joined: 27 Mar 2016, 13:05

14 Aug 2018, 15:24

I tested your code. It is working for me.

I just changed according to showcase code values:

Could you try this ?

Code: Select all

<h:form>

            <p:dataTable id="checkboxDT" var="car" value="#{dtSelectionView.cars5}" selection="#{dtSelectionView.selectedCars}"
                rowKey="#{car.id}" style="margin-bottom:0">
                <p:column selectionMode="multiple" style="width:16px;text-align:center" />
                <p:column headerText="Descripción">
                    <h:outputText value="#{car.id}" />
                </p:column>
                <p:column headerText="Desde">
                    <h:outputText value="#{car.year}" />
                </p:column>
                <p:column headerText="Hasta">
                    <h:outputText value="#{car.color}" />
                </p:column>
            </p:dataTable>

        </h:form>
https://www.primefaces.org/showcase/ui/ ... tion.xhtml

alexone
Posts: 2
Joined: 13 Aug 2018, 20:57

14 Aug 2018, 17:07

Thanks for your response.
But I fund my issue, in the command button I put inmediate="true", so the values never go to the bean.

Thanks again, and I'm sorry for the inconviniance.

huseyinT
Posts: 123
Joined: 27 Mar 2016, 13:05

15 Aug 2018, 09:05

You are welcome.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 36 guests