Note that there are some explanatory texts on larger screens.

plurals
  1. POFire change-event manually
    primarykey
    data
    text
    <p>Hey I've got a problem with fireing a change-event manually.</p> <p>So I have a selectOneMenu (i'ts like a dropdown in jsf) with different values.</p> <p>If I choose a value of this dropdown-list, a datatable should be updated. This works correctly, if i choose this value manually.</p> <p>Now there is a case, where I need to insert a new value to the selectOneMenu. This new value gets selected automatically, but the change-event to update the datatable doesn't get fired...</p> <p>So basically I have this button to save a new value to the selectOneMenu which then gets selected correctly, but the datatable doesn't get updated, which is why I tried to write the function fireChange() and gave that to the oncomplete of the button:</p> <pre><code>&lt;p:commandButton ajax="true" id="seatingPlanSave" actionListener="#{EventAssistentController.createSeatingPlan}" value="#{msg.save}" update=":createEvent:EventSeatingPlan, :createEvent:ticketTypePrices" oncomplete="fireChange()"/&gt; </code></pre> <p>For the fireChange()-function, i tried a few different things:</p> <pre><code>function fireChange() { var element = document.getElementById("createEvent:EventSeatingPlan_input"); element.change(); } function fireChange() { var element = document.getElementById("createEvent:EventSeatingPlan_input"); $(element).trigger("change"); } function fireChange() { if ("fireEvent" in element) element.fireEvent("onchange"); else { var evt = document.createEvent("HTMLEvents"); evt.initEvent("change", false, true); element.dispatchEvent(evt); } } </code></pre> <p>But none of these work :(</p> <p>Can you please tell me how I can achieve this?</p> <p>Thanks, Xera</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload