p:dataTable is not working when ajax functionality is active

UI Components for JSF
Post Reply
iliTheFallen
Posts: 3
Joined: 15 May 2010, 18:24

15 May 2010, 20:09

Hi, all...I am newbie to PrimeFaces(considering, it has not much differences than richfaces or any other component library technologies). i am trying to add a datatable to display a 2 columned html table which one of its column has text values and the other has p:commandLinks for deleting rows individually...

Code: Select all

<p:dataTable emptyMessage="" id="mailsTable" dynamic="true" value="#{mailBean.mails}" binding="#{mailBean.mailsTable}" var="mails">

                            <p:column>
                                <h:outputText value="#{mails}" />
                            </p:column>

                            <p:column>
                                <p:commandLink id="removeMail" value="Delete" process="@this"
                                               update="mailsTable" ajax="true" actionListener="#{mailBean.removeMail}"/>
                            </p:column>

                        </p:dataTable>
When i click on the "Delete" Button, my action is not fired...What might be the wrong?
Your advices are welcome :)...
P.S. i am using 2.0.1 version of primefaces and i do not add "<p:resources/>" to head tag...Also i am using facelets for templating...Up till now all other components have worked fine :)...
Furthermore, firebug always displays an error message which is "elTable.tBodies is undefined" and when my List<String> mails is null(or empty), datatable always displays a message as emptyMessage===>Loading...

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

17 May 2010, 10:41

Hi,

Yes, it's not working. The problem is process="@this" attribute. I've tried with various IDs in process as well, but client IDs in partial request are very strange. The solution is - don't write process at all. Take out process="@this" and you will see it should work.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

User avatar
boscooo
Posts: 55
Joined: 07 Apr 2010, 15:48
Location: Brazil

17 May 2010, 12:03

Hi!

I've faced same situation of update datatable after delete/update rows.
Add a p:outputPanel enclosing the datatable and rerender it! You don't even need the process attribute.

The only thing that is strange is: when you rerender, the datatable stretches before be able to view...
JBoss Seam 2.2.0 GA Web Framework
Mojarra 1.2_15-SNAPSHOT JSF Implementation
PrimeFaces 1.0.2 Final
RichFaces 3.3.3 Final
JBoss AS 4.2.2 GA

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

19 May 2010, 15:09

This is not PrimeFaces related but more like standard JSF behavior, you can also experience this with f:ajax.

See: http://code.google.com/p/primefaces/iss ... ail?id=812

I've asked this to JSF expert group, waiting for response now.

iliTheFallen
Posts: 3
Joined: 15 May 2010, 18:24

19 May 2010, 20:14

Hi, m8s thanks for your replies...I think the problem occurs when datatable and accordion panel are nested(accordion panel-->parent, datatable-->child as you might guess)... All other combinations of components with datatable work excellent...i hope the problem will be solved in near future with primefaces' new releases...For now, i have changed accordion panel to panel...

P.S. i will be watching the thread...

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

19 May 2010, 21:32

iliTheFallen wrote:Hi, m8s thanks for your replies...I think the problem occurs when datatable and accordion panel are nested(accordion panel-->parent, datatable-->child as you might guess)... All other combinations of components with datatable work excellent...i hope the problem will be solved in near future with primefaces' new releases...For now, i have changed accordion panel to panel...

P.S. i will be watching the thread...
I have datatable in p:panel. It doesn't work with process defined by child in column. You can try absolute Id or relative from the next closest parent. No chance. Without process is everything fine.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

iliTheFallen
Posts: 3
Joined: 15 May 2010, 18:24

19 May 2010, 23:03

Code: Select all

<p:panel id="mailPanel" header="#{bundle.MailGirisi}">
                        <h:form id="mailForm" prependId="false">


                            <h:panelGrid columns="1">

                                <h:panelGroup>
                                    <h:outputLabel for="mailText" >
                                        <h:outputText value="Email:"/>
                                    </h:outputLabel>
                                    <h:inputText id="mailText" value="#{mailBean.mailText}" required="true">
                                        <f:validator validatorId="mailValidator" />
                                    </h:inputText>

                                    <!-- Mesajin Update Edilmesi Lazim Aksi Takdirde Sadece DataTable Ile Ilgili Partial-Response Donuyor-->
                                    <p:commandLink id="addMail" value="Ekle" process="@this,mailText"
                                                   update="mailsTable,allMessages" async="true" actionListener="#{mailBean.addMail}"/>
                                </h:panelGroup>


                                <p:dataTable id="mailsTable" emptyMessage="Mail Giriniz" binding="#{mailBean.mailsTable}"
                                             value="#{mailBean.mails}" var="mails">
                                    <p:column>
                                        <h:outputText value="#{mails}" />
                                    </p:column>

                                    <p:column>
                                        <p:commandLink id="removeMail" value="Sil" async="true" process="@form"
                                                       update="@form" actionListener="#{mailBean.removeMail}"/>
                                    </p:column>

                                </p:dataTable>

                            </h:panelGrid>

                        </h:form>
                    </p:panel>
This works fine for me...The only problem is when you want to use p:accordionPanel with p:datatable, they cannot be nested whether there is a process attribute defined or not...I don't know may we use different versions of primefaces...I use 2.0.1 with JSF-2.0.2-FCS implementation and deploy it to glassfishv3 webcontainer...

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

24 May 2010, 15:31

Copy/Paste from my comment to the issue in tracker;
This turned out to be an implementation bug of UIData getClientId in MyFaces and Mojarra, I'll create issue
tickets in these projects related to this. For now I'll postpone this issue as fixing this in PrimeFaces side is too
big for the next release, we'll experiment after that.

These are a result of my discussion with JSF Expert Group members.

Still there is a quick tworkaround for this to use an outputpanel enclosing datatable and update that instead of
UIData.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 50 guests