Jump to content

Xera

Members
  • Posts

    1
  • Joined

  • Last visited

Xera's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Hey I've got a problem with fireing a change-event manually.So I have a selectOneMenu (i'ts like a dropdown in jsf) with different values.If I choose a value of this dropdown-list, a datatable should be updated. This works correctly, if i choose this value manually.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...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:commandButton ajax="true" id="seatingPlanSave" actionListener="#{EventAssistentController.createSeatingPlan}" value="#{msg.save}" update=":createEvent:EventSeatingPlan, :createEvent:ticketTypePrices"oncomplete="fireChange()"/> For the fireChange()-function, i tried a few different things: function fireChange() { var element = document.getElementById("createEvent:EventSeatingPlan_input");element.onchange();} 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);} But none of these work :(Can you please tell me how I can achieve this?Thanks, Xera
×
×
  • Create New...