p:ajax not working where f:ajax works

UI Components for JSF
Post Reply
pandasys
Posts: 9
Joined: 17 Jan 2011, 23:51

22 Jan 2011, 18:15

I place an p:ajax tag in a selectManyCheckbox and it is not behaving the same as an f:ajax (Mojarra 2.0.4) tag. I have an "All" checkbox that when I see it in set method I set all the other checkboxes to selected. This is not being updated correctly when using the p:ajax tag.

I see the ajaxstatus being activated. Also, when I add a listener to p:ajax, it's not being invoked.

The code that works is commented out. Am I doing something wrong here? Note that the p:commandButton works correctly.

Code: Select all

        <ui:define name="nutritionDataStackContent">
            <h:form prependId="false">
                <h:panelGroup>
                    <h:panelGrid columns="2" style="width: 100%;">
                        <h:outputLabel for="foodGroupSelect" value="#{msgs.foodGroupTreeLabel}" style="font-weight: bold;"/>
                        <p:commandButton id="#{foodGroupController.clearAllId}"
                                         value="#{msgs.clearAllButtonLabel}"
                                         action="#{foodGroupController.clearAll()}"
                                         style="align: right; font-size: .8em;"
                                         update="foodGroupSelect foodDataTable"/>
                    </h:panelGrid>
                    <h:panelGrid id="foodSelectPanel">
                        <h:selectManyCheckbox id="foodGroupSelect"
                                              layout="pageDirection"
                                              value="#{foodGroupController.foodGroupSelections}" >
                            <f:selectItems id="foodGroupSelectItems" value="#{foodGroupController.allFoodGroups}"
                                           var="group" itemLabel="#{group.foodGroupDescription}" itemValue="#{group.foodGroupCode}"/>
                            <!--<f:ajax render="foodGroupSelect"/>-->
                            <p:ajax update="foodGroupSelect"/>
                        </h:selectManyCheckbox>
                    </h:panelGrid>
                </h:panelGroup>
            </h:form>
        </ui:define>
PrimeFaces 2.2 SNAPSHOT Build #251 (Jan 26, 2011 1:03:27 AM)
JSF 2.0 (Mojarra 2.0.4)
Glassfish 3.0

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

24 Jan 2011, 11:22

Hi,

I think, you should specified "change" or "click" event explicity with p:ajax. Simply <p:ajax render="..." update="..."/> inside h:select... didn't work with PF 2.0.2 as well (before using standards).
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

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

24 Jan 2011, 12:33

Also try 2.2-SNAPSHOT.

pandasys
Posts: 9
Joined: 17 Jan 2011, 23:51

24 Jan 2011, 15:29

I had previously tried various event="", including "click" and that did not work.

I updated to SNAPSHOT and it now works. "change", "click", or none for event= all work. I now use event="change". If not the best choice, please let me know.

Thanks for the fast response and turnaround.
PrimeFaces 2.2 SNAPSHOT Build #251 (Jan 26, 2011 1:03:27 AM)
JSF 2.0 (Mojarra 2.0.4)
Glassfish 3.0

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

24 Jan 2011, 15:34

Glad it works for you now, we have fixed an issue lately regarding p:ajax and select components. Thanks for confirming.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 49 guests