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.
- Previously the JS
modal()
call was inside an 'onclick' event'. - Added a 'dummy' method as the modal dialog is never shown with the actual code, as I thought I needed a kind of trigger to it.
- It's not a
b:commandButton
as it refreshes the whole page and dialog is never shown.