p:selectOneMenu using a mask in 'editable' mode - primefaces

The following works
<p:selectOneMenu value="#{f.entrada1}" editable="true">
As does
<p:inputMask mask="99:99" value="#{f.saida1}">
I do not seem to be able to combine the two in some way or add a mask to the editable p:selectOneMenu in a different way?
My PrimeFaces version is: ....

Version PrimeFaces 5.3.
Or put a list in inputMask. it's possible?

Related

PrimeFaces Schedule not showing all times with some SlotDuration configuration

When using the default slotDuration of PrimeFaces Schedule, or "00:15:00" for an example, the component don't show all times. If I change it to some values like "00:45:00" or even "00:15:01", the schedule show all times correctly.
Inspecting the HTML/CSS, in the cases of not showing the time, the <td> tag don't have a <span> tag inside with the time, and has the CSS class "fc-minor"
I couldn't find in documentation about this problem. I already tested with the deprecated slotMinutes, but it has the same behaviour.
Schedule with blank spaces between times:
https://imgur.com/a/TOCey4R
Schedule code:
<p:schedule id="agendaOcupacional" allDaySlot="false" timeFormat="HH:mm" axisFormat="HH:mm"
draggable="false" resizable="false" slotDuration="00:15:00" timeZone="GMT-3"
displayEventEnd="true" value="#{agendamentoBean.lazyEventModel}" locale="br"/>
I'm using Primefaces 6.1.
Thanks.
It appears PF is missing the value for slotLabelInterval which fixes this issue.
I created this GitHub issue: https://github.com/primefaces/primefaces/issues/4896
Submitted this PR: https://github.com/primefaces/primefaces/pull/4897
Hopefully it will be fixed in PrimeFaces 7.1.
For now you can use the Extender to configure it: https://primefaces.github.io/primefaces/7_0/#/components/schedule?id=extender-method

Primefaces 6.1 SelectOneMenu pick itemLabel as value

I am using PrimeFaces 6.1 SelectOneMenu to render a editable/filtered dropdown menu with itemLabel/value as selectItems. Unfortunately, selectOneMenu pick itemLabel as value put it in my selectOneMenu value field. This is very annoying issue and maybe it is a bug.
There is my snippet code:
I am using Map to hold ID/Name pair as selectItems:
Map<String,String> hm = new HashMap<String, String>();
hm.put("Cust001","John Dow");
hm.put("Cust002","Mark Polo");
hm.put("Cust003","Noel Max");
then I put it in my selectOneMenu as:
<p:selectOneMenu id="selectCustomerId" value="#{paymentControlBean.selectedCustomerId}" effect="fold" editable="true" filter="true" filterMatchMode="startsWith">
<p:ajax update="paymentListToolbar"/>
<f:selectItems value="#{hm.entrySet()}" var="entry" itemValue="#{entry.key}" itemLabel="#{entry.value}"/>
</p:selectOneMenu>
Dropdown list rendering works fine, but when I pick one from the dropdown list and then press process it. My backing bean paymentControlBean.selectedCustomerId shows up "John Dow", which means, selectOneMenu pick my itemLabel into my selectOneMenu's value field.
I tried to change the PrimeFaces element to p:selectOneListBox and keep everything no change, repeat the processing, my backing bean shows up "Cust001", which is working fine.
From this comparison I found out, there must a serious bug exists in PrimeFaces 6.1, and it is same bug existing in PrimeFaces 5.2 as well.
SelectOneMenu is very popular in dropdown list selection, especially when we have to handle key/value pairs by using Map.
If it is not a bug, what I can do or have an other work around to make it pick up right value in my selectItems?
Please advise>
I have fixed it with this PR: https://github.com/primefaces/primefaces/pull/2870
It will be in PrimeFaces 6.2 release coming out in November 2017.

Primefaces - Dialog Framework - p:confirm not opening

Primefaces (5.2, Mojarra 2.2.13) inside Dialog Framework is not opening a <p:confirm>-MessageBox.
I have delete icons in a datatable as a <p:commandLink> per row inside a Dialog.
I want to have a user confirmation to delete every row.
Following code works as expected in a <p:dialog> but not using Dialog Framework. Dialog Framework blocks the click on the delete icon or in other words: shows the confirm box invisible and answers NO.
<p:dataTable id="idTblMfc" value="#{bnMfcs.rows}" var="ORow" editable="true" ...>
... Columns ...
<p:column>
<p:commandLink styleClass="ui-icon ui-icon-trash" title="#{msg.TXT_DELETE}" actionListener="#{bnMfcs.doDelete(ORow)}" update="idTblMfc">
<p:confirm header="#{msg.TXT_DELETE}" message="#{msg.PRM_DEL_CONT_MARKED}" icon="ui-icon-alert" />
</p:commandLink>
</p:column>
I tried the same with <p:confirmDialog> instead of <p:confirm> with the same result. OK, I found the tiny difference that <p:confirmDialog> doesn't block the delete icon click but also does not appear.
The rest of the dialog and the datatable works as expected even with message boxen shown with showMessageInDialog(...).
Any ideas?
As you can see in the showcase (http://www.primefaces.org/showcase/ui/overlay/confirmDialog.xhtml), you need both p:confirm (where you need confirmation) and p:confirmDialog (which defines how the dialog looks like).
Also make sure that you are in a h:form tag.
Solution found!
The documentation makes not clear that <p:confirmDialog> is mandatory. I had one on my main page and the page using Dialog Framework had not.

primefaces selectManycheck box columns attribute is not working

I am using Primefaces 3.5, as shown in showcase, i am trying to use p:selectManyCheckBox.
<p:selectManyCheckbox layout="grid"
columns="2"
value="#{bean.selectedList}">
<f:selectItems itemLabel="#{bean.value}"
itemValue="#{overrides}"
value="#{bean.overrideValues}"
var="overrides>
</p:selectManyCheckbox>
But columns attribute is not working, is there any way to get column wise disply ?
I had the same problem and I fixed by changing the version of the prime face.
I had 3.2 and changed to 4.0.
For this particular component it seams that it whose added in the last 2 moth.
Requested here and a specific task here.
Is the second time when I also had this kind of problem. I am looking on the prime face showcase website for a specific component and and when I tried that component it didn't work with my version.

PrimeFaces PickList : two String fields filter

I was wondering if it's possible to have a two fields filter with a picklist of primefaces.
I tried this but it's not working. I would like to filter on firstname and name but they are in two different fields.
<p:pickList value="#{bean.usersDualModel}" var="user"
itemValue="#{user}" itemLabel="#{user.firstname} #{user.name}"
converter="user" showSourceFilter="true" showTargetFilter="true"
filterMatchMode="contains" >
<p:column>
<h:outputText value="#{user.firstname} #{user.name}" />
</p:column>
</p:pickList>
Thanks
In fact, I think it's possible because it's working know with the code I posted above. However, the Javascript method is easy to set up with two fields so I could have done it quickly. Thanks for the suggestion.
The reason it wasn't working the first time is that there is an bug in Primefaces for the picklist filter and it's not patched officialy. The filter mode stayed in startsWith whatever the value I entered.
So my picklist is still
<p:pickList value="#{bean.usersDualModel}" var="user"
itemValue="#{user}" itemLabel="#{user.firstname} #{user.name}"
converter="user" showSourceFilter="true" showTargetFilter="true"
filterMatchMode="contains" > ...
And there is a custom patch by know. Here is the link of the report.
https://code.google.com/p/primefaces/issues/detail?id=5234
This is not possible with the default component. However you can create a custom filter (example taken from Primefaces manual):
<p:pickList value="#{pickListBean.cities}" var="city" itemLabel="#{city}"
itemValue="#{city}" showSourceFilter="true" showTargetFilter="true
filterMatchMode="custom" filterMatchMode="myfilter">
</p:pickList>
function myfilter(itemLabel, filterValue) {
//Filter for firstname or name
//return true or false
}
Of course you can also create a custom component by extending the primefaces picklist or create two seperate inputtext fields and fire any filtering manually with javascript/jquery.