jsfmodal-dialogbootsfacesajax-update

Unable to update bootstrap modal with onclick


Currently I'm trying to open a modal dialog that contains a form filled with the values from a backing a bean. The bean is loaded (or should be loaded, as at the moment isn't working) with an object provided in the button as each button is linked with an entry in a table. The current code for the button is the following one.

The modal and the button that triggers the event are on the same page, but this page has 2 beans. One used for the modal that should be shown as soon as you click the button (used to modify the given object) and another one to print all the data in the main window.

Basically what I'm trying to do is to instantiate a bean passing a given object to the @PostConstruct method that the second bean has via the request, and having the modal shown after all that process is completed, refreshing the modal and then showing it up.

<b:button value=""
    icon-size="2x"
    onclick="#{bean.dummy()}"
    style="height: 64px; width: 64px; float: right; border: none; margin-top: 25px; border-radius: 0px;"
    oncomplete="$('.config_modal').modal()">
        <f:param name="action" value="#{bean.value}" />
</b:button>

Apart from that code I've tried several modifications listed below. The previous one is the most recent.


Solution

  • the oncomplete will not fire after a page reload. you would need to use ajax. e.g. <h:form><b:commandButton value="click" action="#{bean.dummy}" oncomplete="$('.config_modal').modal('true');"><f:ajax render="@form"/></b:commandButton></h:form>. any part of the page you want redrawn would have to be inside the <h:form>