-1

I am new in Primefaces, i would like to know if i can use two values for the attribute update on primefaces commandButton component:

My code

<p:messages id="messages" ...../><!-- not always updated -->
<h:form>
    ...
    <p:commandButton ....action="search" update="@all :messages"/>
    ..
</h:form>
<h:form>
    <p:panel header="Number of element in the the table:#{bean.number}">
        <!--not always updated -->
        <p:datatable>
            <!-- always updated -->
        </p:datatable>
    </p:panel>
</h:form>

When i did this, the header of the panel component is not updated.

When i put only update="@all", the messages component (p:messages) is not updated even with autoUpdate="true"

Can you help me please !

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
Chicov
  • 19
  • 5
  • Short answer: yes you can put two values in the update attribute, just the way you did it. What exactly would you like to happen? If you would like that everything on the page gets updated why not do a normal, non-ajax request? – user1983983 Feb 10 '16 at 16:16
  • @user1983983, When i put ajax="false", the full page is updated and te custumer don't want this. i want a partial update for the p:messages and the p:panel.. I don't understand why when i put @ all it works fine except for p:messages and when i added :messages into the update attribute, the panel header does not updates :( ! – Chicov Feb 10 '16 at 16:26
  • The action value is used with spring webflow in a transition, there is no problem on it.. – Chicov Feb 10 '16 at 16:53
  • Ok, good luck then… I still suggest to learn some jsf basics and debugging skills (do you actually know what @all does? And learn why messages don't 'survive' pages transitions etc… – Kukeltje Feb 10 '16 at 16:56
  • 1
    http://forum.primefaces.org/viewtopic.php?f=3&t=313 – Kukeltje Feb 10 '16 at 17:02
  • Thanks for all, I'll see :).. – Chicov Feb 11 '16 at 08:14

1 Answers1

-1

Don't use @all, is bad practice (http://forum.primefaces.org/viewtopic.php?f=3&t=6956#p36841).

If you want to update a specific component or form you can use jQuery Selectors: PFS (PrimeFaces Selectors) - Showcase

So, you can put an id on the second form and specify it in the update attribute.

X-spert
  • 264
  • 2
  • 11
  • Thanks for your answer, in fact i tried to specify the p:panel component id to the update attribute, but it refreshes all the page and the custumer don't want this. I tried to use @(.ui-message), no changes. Now, the message is updated and the panel also, but there is a full page refresh... – Chicov Feb 10 '16 at 15:21