p:dataTable and p:commandButton with AJAX

UI Components for JSF
Post Reply
oranheim
Posts: 64
Joined: 23 Jun 2010, 12:37
Location: Oslo, Norway
Contact:

09 Dec 2011, 15:13

I'm not able to get a p:commandButton to fire my AJAX action in a p:dataTable.

Code: Select all

<p:dataTable ...>
<p:column>
   <p:commandButton style="clear: right;" image="ui-icon ui-icon-arrowreturn-1-w" action="#{messengerService.createResponse}">
      <f:setPropertyActionListener target="#{messengerService.selectedMessageId}" value="1001"></f:setPropertyActionListener>
   </p:commandButton>
</p:column>
</p:dataTable>
I have tried all kinds of combinations: only actionListener, only action, using p:ajax, using p:remoteCommand, etc.

Please advice!
JBoss AS 7.1
Mojarra 2.1.5
Seam 3.1.0.Final
PrimeFaces 3.1.1
PrettyFaces 3.3.2

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

09 Dec 2011, 15:24

Does h:datatable work?

oranheim
Posts: 64
Joined: 23 Jun 2010, 12:37
Location: Oslo, Norway
Contact:

09 Dec 2011, 15:56

No, it doesn't either and that's why I hoped PrimeFaces to work out.
JBoss AS 7.1
Mojarra 2.1.5
Seam 3.1.0.Final
PrimeFaces 3.1.1
PrettyFaces 3.3.2

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

09 Dec 2011, 15:59

Then there is sth wrong with your bean.

oranheim
Posts: 64
Joined: 23 Jun 2010, 12:37
Location: Oslo, Norway
Contact:

09 Dec 2011, 16:33

optimus.prime wrote:Then there is sth wrong with your bean.
You are right! I made a test case outside my app and there it works.

Thanks for your help :)
JBoss AS 7.1
Mojarra 2.1.5
Seam 3.1.0.Final
PrimeFaces 3.1.1
PrettyFaces 3.3.2

oranheim
Posts: 64
Joined: 23 Jun 2010, 12:37
Location: Oslo, Norway
Contact:

09 Dec 2011, 17:40

optimus.prime wrote:Then there is sth wrong with your bean.
My issue turns out to be two folded:

1) I passed a request.messageId to by bean, in which was not propogated during the sub-sequent ajax request and caused it to fail. Wrong bean state managmenet.

2) It turns out the new resource aggregator got a bug. It throws an IndexOutOfBoundsException: Index: 0, Size: 0 when you use a ui:fragmenet within a h:head -> f:facet name="first".

I truncate the IndexOutOfBoundsException using Seam Catch, so I'm somewhat fine for now. But, it's a real blocker for Seam 3.1 devs, because of Seam 3.1's Transaction Filter mechanism. Conversely, if you use a ui:fragment in h:head, all Seam Transactions will suffer from being rollbacked.

Hope you can try to reproduce and look into it.

Code: Select all

    <f:facet name="first">    
        <meta content='text/html; charset=UTF-8' http-equiv="Content-Type" />
        <meta name="keywords" content="concert,live music,contract,performance contract,agreement,booking,calendar,performing arts,musific,artist,venue,band,choir,orchestra,manager,stage" />

        <ui:fragment rendered="#{!('/parts/public/profile/profile-view.jsf'.equals(request.requestURI))}">
        <meta name="description" content="Comprehensive on-line services for artists, venues, and professional intermediaries in the live music industry. Enhance the potentials of live music with online booking and contracting." />
        </ui:fragment>

        <ui:fragment rendered="#{'/parts/public/profile/profile-view.jsf'.equals(request.requestURI)}">
        <meta name="description" content="#{unitProfileView.metaDescription}" />
        </ui:fragment>
        <title><h:outputText value="#{bundles.messages['musific.title']}" rendered="#{!'/parts/public/profile/profile-view.jsf'.equals(request.requestURI)}"/><h:outputText value="#{unitProfileView.metaTitle} on Musific" rendered="#{'/parts/public/profile/profile-view.jsf'.equals(request.requestURI)}"/></title>
        <link rel="shortcut icon" href="#{resource['gfx:favicon.ico']}" type="image/x-icon" />
    </f:facet>
JBoss AS 7.1
Mojarra 2.1.5
Seam 3.1.0.Final
PrimeFaces 3.1.1
PrettyFaces 3.3.2

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

16 Dec 2011, 16:35

Maybe you should discuss this with your friends at seam-dev chat room, it is always a PrimeFaces bug isn't it?

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 21 guests