I have a jsf form of registration that usually works on a select one menu is displayed a list of vehicles, in case the user needs to register a new vehicle for the issuance of the note he clicks one side of the select menu and opens a dialog to register .
Until then everything is working but when I close the dialog the registered vehicle only appears after typing F5. How can I do to update the select one menu. It is important to point out that the registration of the notes and open dialog xthmml are different pages, so do not know how.
Try putting styleClass="vehicles" to <p:selectOneMenu>, and update="#(.vehicles)" on <p:commandButton> in the dialog (the button in the dialog that adds the new vehicle). If everything is wired up correctly in the managed bean (the list that select one menu displays is updated), you should see the new car in the list.
<p:selectOneMenu styleClass="vehicles" ...>
<p:commandButton update="#(.vehicles)" ...>
Related
As title stated, I want to put icon and badge beside the title of submenu of Panel Menu. However, Primefaces' submenu default icon is the expand arrow/triangle. When I do this:
<p:badge value="2">
<p:submenu icon="pi pi-envelope">
</p:badge>
It will prompt error, and doing vice versa like wrapping badge and closing using </p:submenu> is impossible because there are menuitems also. Not to mention the icon is not showing.
So, can I really achieve this using free open source provided? Or this is exclusive to paid user only?
Example from Primefaces template
Badges are not supported on (sub)menu items at this moment (PrimeFaces 11). No matter if you use a free or paid theme. The only component that currently supports a badge on a child node is p:speedDial. What you can do is open a feature request and if possible submit a pull request.
See also:
https://github.com/primefaces/primefaces/issues/7898
https://github.com/primefaces/primefaces/pull/7922
I have a JSF page powered by a session-based backing bean. The page also includes a rich:popupPanel modal window which contains a form with couple of cascading elements and a couple of text boxes. The first time I input values into the form and press the Cancel button, the popup disappears. But when I click on the commandButton which displays the popup again, the drop-downs and input text boxes show the previously input values, even though I reset the underlying properties in the backing bean. It is as though the JSF UI elements' state is being cached, because for debugging purposes I print the underlying property values at the bottom of the popup and those are null (or empty).
Why is this happening and is there an effective way to reset the form UI elements' state?
Showing and hiding is just flipping between visible and invisible state. You need to rerender the popup every time you open it if you want it to use the current values.
Edit: Sample code
<a4j:commandButton render="popupPanelId" execute="#this"
oncomplete="#{rich:component('popupPanelId'}.show()" value="Click me" />
I have a primefaces multiple select table populated from a backing bean. I am using the table.getSelectedRowsCount() javascript widget var to validate atleast one selection and it is working fine.
I now want to throw up a javascript confirmation dialog based on the state of the selected rows. for ex I have a button at the bottom of the table for printing the details of selected rows. I need to check a certain field of the bean and then allow printing.
IN pseudo code
if (#{bean.isComplete})
allowPrinting();
else
// alert user that this row is not yet in complete state
Update and panelGroup on button ajax event as shown in follow.
<h:panelGroup id="validateRerpot">
<h:panelGroup rendered="#{bean.isComplete}">
<script type="text/javascript">alert('show Dialog inplace');</script>
</h:panelGroup>
</h:panelGroup>
Try to update validateReport panel
I'm trying to generate dynamic chat windows within a PanelGroup. The structure is like this:
<h:panelGroup id="chats">
<p:dialog id="chatWindow1">
</p:dialog>
<p:dialog id="chatWindow2">
</p:dialog>
</h:panelGroup>
The problem is when I'm adding a new chat window, it's not showing. I think the newly created dialog is not updating [ by RequestContext's update method] since it's not existing yet in view. So, I've to update "chats" panel group in order to see the new dialog. But the problem in that is pre-existing dialogs in that panel group gets updated.
Consider a scenario: user types some text in chat window.Suddenly a new chat window pops up & all his chat text in that pre-existing dialog vanishes.
I just want to prevent that scenario. How can it be done?
dudes, does any of you know how to do this?
i have a page that has a datatable on it. it has a button to delete a row. the button works as expected, when you click it, it will delete the selected row/s. i also have another button that opens a popup window where you search for items and them add them to the said datatable. i am having a hard time figuring out how to refresh the datatable once you click the "select" button on the popup window.
my solution is having a hidden button that will refresh the datatable. it works when i litterally click it. but when i trigger the click event on the popup window using javascript, it doesnt always work. sometime it refreshes, sometimes it doesnt.
what's actually the best way to refresh a datatable?
If you use JSF2.0, there is an option to update part of your application with
<h:form>
...
...(here you have the binding data)
<h:commandButton action="#{yourbean.updateRows}" >
<f:ajax render="tableName" />
</h:commandButton>
</h:form>
EDITED
If you want to invoke it from JAVASCRIPT use:
document.getElementById('elementName').click();
How are you accessing your DataTable in the popup window ? by keeping it in some session variable and in you parent page are you displaying the datatable through some UI Component like GridView ? In that case you can reload your parent window from where you opned the popu windo through javascript. E.g. window.opener.location.reload();
I can think of .. Datatable.AcceptChanges(); But that's for C#..