Primefaces: How to add icon and <p:badges> inside <p:submenu> on Panel Menu? - jsf

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

Related

Clear PrimeFaces TreeTable selection

How to implement a "Clear All Selection" button which will uncheck all selected things from a TreeTable implemented using PrimeFaces 6.2
I would use the client side API for this. It allows you to unselectAllNodes. You can use it in combination with the widgetVar of your tree table:
PF('yourWidgetVar').unselectAllNodes()
In a button, use it like:
<p:button value="Clear selection"
onclick="PF('yourWidgetVar').unselectAllNodes();return false"/>
Note that the linked documentation applies to the latest release, but the unselectAllNodes function is also present in 6.2:
https://github.com/primefaces/primefaces/blob/6_2/src/main/resources/META-INF/resources/primefaces/treetable/treetable.js#L701-L709

How to upgrade select one of my other xhtml page?

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)" ...>

Pop up Window in spring web flow

i am still new to spring.I need to make a popup window when the button is clicked in spring web flow.
Let say in html file
<h:commandLink value="Sick Leave" action="sickleave" id="sickleave" /></div>
When the action command link is clicked I have to populate the page with some value on-entry itself.
In my flow.xml
<transition on="sickleave" to="sickLeave"></transition>
<view-state id="sickLeave" view="sickLeave.xhtml" popup="true"></view-state>
i have added popup=true.But still i am not able to get a popup window.
I think you need a to use a sf:commandLink component instead of the h:commandLink setting the reRender tag as follows:
<sf:commandLink value="Sick Leave" action="sickleave" reRender="#{flowRenderFragments}" processIds="*" id="sickleave" />
I'm not sure if the "processIds" tag is needed, so try it with and without it.

JSF 2.0 and Primefaces integration for ajax update of center section

I have left, right and center panels in my xhtml page. Left panel contains menu item links and want to use them to refresh the center section through ajax.
I have seen quite a few links related to this but I am not sure on the final solution.
If this is not the preferred approach, please do guide on the same.
I am using managed beans which are sessionscoped and xhtml file uses following to do the dynamic call.
<p:menuitem value="Done" action="#{navBean.setPageName('done')}" update="centerPanel" immediate="TRUE" />
When I use primefaces 2.2.1, i am able to update the center panel on second click only from the menu in left panel.
When I use primefaces 3, the center section doesn't get updated.
The managed bean setter does get invoked in both cases.
Is it something to do with primefaces configuration or am I missing something?

jsf, richfaces, popup window

I would like to make a list-detail view with richfaces. There will be a link for every record in the list that should open a new window containing record details.
I tried to implement the link this way:
<a4j:commandLink oncomplete="window.open('/pages/serviceDetail.jsf','popupWindow', 'dependent=yes, menubar=no, toolbar=no, height=500, width=400')" actionListener="#{monitoringBean.recordDetail}" value="details" />
I use <a4j:keepAlive beanName="monitoringBean" ajaxOnly="false" /> for both the list and the detail page. recordDetail method fills the data of the selected record to a variable of the bean that I would like to display on the detail page.
The problem is that keepalive doesn't work, so I get new bean instance on the detail page every time. So the the previously selected record from the other bean is not accessible here.
Is there a way to pass parameter (id) to the detail page to handle record selection. Or is there any way to make keepalive work? (I this this would be the easiest).
Thanks
Avoid using window.open(..) - it will fail on most browser configurations nowadays (due to pop-up blocking).
Use <rich:modalPanel> instead.

Resources