0

I'm using Soteria 1.0.1 , Mojarra 2.3.9 and PrimeFaces 6.1. on Glassfish 5.1

Inside a ui:repeat the ajax listener is not called on the change-event. The listener is called only once on the click-event. Which event should be used?

I've used foreach to iterate, but the listener is not called.

I've changed the execute-attribute from @this into :frmOverviewPlant:selectDyna3 and :rep_mandatory3:selectDyna3 , but still the listener is not called

If I change f:ajax event="change" into f:ajax event="click" the listener is called but only once.

If I omit the attributes execute: and render: , and use immediate="true" instead, the listener is called. But this is not useful because the value is not sent back to the listener.

If I use the same selectOneMenu outside ui:repeat, the listener is called even without setting the ajax-attribute execute.

Which component could be used to iterate over a dynamically generated list? That list changes each time another main-item is selected. The details of that main-item are rendered in the form.

Is this behaviour caused by ui:iterate? or by invalid values for the ajax-attributes event: or render: or execute: ?

    <h:form id="frmOverviewPlant" prependId="false">
    <table style="width: 30%" border="0">
        <ui:repeat id="rep_mandatory3" value="#{assortiment.mandatoryPropertyList}" var="VBNprop">
        <tr><td class="noWrap"> <h:outputText styleClass="#{VBNprop.codevaluesW.value == null  ? 'error' : ''}" value="#{msg[VBNprop.codevaluesW.mainCode]}"/></td>
            <td class="noWrap"> 
                <h:selectOneMenu id="selectDyna3" value="#{assortiment.plantdetail.addedProperty}" > <f:selectItems value="#{VBNprop.codevaluesList}" /> 
               <f:ajax event="change" listener="#{assortiment.checkAddProperties}"  execute="@this"  render=":frmOverviewPlant:idTabView:grp_properties"/>
                </h:selectOneMenu>
            </td>
           </tr>
      </ui:repeat>
       </table>
    </h:form>

I expect the listener is called in order to update the main-item with the selected option.

Selaron
  • 6,105
  • 4
  • 31
  • 39
  • 2
    Start with reading https://stackoverflow.com/questions/7415230/uiform-with-prependid-false-breaks-fajax-render – Kukeltje Oct 16 '19 at 12:04
  • First of all, we can't create ids inside right? as JSF will throw an exception for duplicate id. – Ganesa Vijayakumar Oct 16 '19 at 12:35
  • Did the OP say that he got an exception for duplicate ID .. ?? – BalusC Oct 16 '19 at 13:24
  • thanks to all, I've made 2 changes and now it works: 1. 'Possible causes nr 4." of https://stackoverflow.com/questions/2118656/commandbutton-commandlink-ajax-action-listener-method-not-invoked-or-input-value, I've created the list used in ui:repeat as a final list and refilled it with new items whenever needed 2. I've removed execute attribute in the ajax event. – user2448443 Oct 17 '19 at 10:33

1 Answers1

-1

I couldn't able to give you a straight answer to your question since your statements say that everything is good. but I have noticed the following in your code.

  • We can't create id inside since the JSF view won't allow duplicate ids.
  • Make sure your listener method should have the param AjaxBehaviorEvent For (example - methodXXXX(AjaxBehaviorEvent event)
  • Please make sure we shouldn't render the parent group of which includes the drop-down actions.
  • Let's try valueChangeListener which is specifically introduced for value change actions.
  • If you want to render the parent area of then I suggest you make it possible by javascript since I didn't find any solution by using any JSF components.
Ganesa Vijayakumar
  • 2,422
  • 5
  • 28
  • 41