How can I explicitly set the decimal separator (and thousand separator) for a calculator bound to a p:inputText? Otherwise the calculator even "swallows" the decimal separator (for me: ",") when entered on the input field.
--Heiko
Calculator and decimal separator
Can you paste your snippet of the calculator so I can see it?
Also have you tried setting the locale="" of the Calculator?
Also have you tried setting the locale="" of the Calculator?
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
Yes. I also tried to set the locale. Without success.
I should have mentioned that I set the calculator on an inputText that's inside a composite in the first place (see below). Sorry for that!
Here's the composite "tdInput:weight":
I should have mentioned that I set the calculator on an inputText that's inside a composite in the first place (see below). Sorry for that!
Code: Select all
<tdInput:weight id="weight" value="#{orderListHandler.simpleOrderHandler.workingObject.currentOrder.orderControl.transportOrder.consignmentItemsRW[0].weight}" displayMode="compact" label="#{bundles.messages['weight']}" />
<pe:calculator for="weight:weight" showOn="button" />
Code: Select all
<composite:interface>
<composite:attribute name="value" required="true" />
<composite:attribute name="disabled" default="false" />
<composite:attribute name="calculated" default="false" />
<composite:attribute name="calculatedValue" />
<composite:attribute name="calculatedLabel" default="#{bundles.messages['calculated']}" />
<composite:attribute name="displayMode" required="false" shortDescription="Defines the size/width of the component. Possible values: 'compact', 'normal'. Default is 'normal'" />
<composite:attribute name="unit" default="#{defaultWeightUnit}" type="net.transdata.komalog.ui.converter.WeightUnit" />
<composite:attribute name="returnType" default="WEIGHT" shortDescription="Type of value object. WEIGHT and DOUBLE supported." />
<composite:attribute name="style" required="false"/>
<composite:attribute name="tooltip" required="false" />
<composite:attribute name="styleClass" required="false"/>
<composite:attribute name="label" />
<composite:clientBehavior name="change" targets="weight" event="change" />
</composite:interface>
<composite:implementation>
<div id="#{cc.clientId}" class="componentdiv">
<p:inputText id="weight"
label="#{empty cc.attrs.label ? component.clientId : cc.attrs.label}"
value="#{cc.attrs.value}" disabled="#{cc.attrs.disabled}" readonly="#{cc.attrs.calculated}" validator="komalog.WeightValidator"
style="#{cc.attrs.style} #{cc.attrs.displayMode == 'normal' || empty cc.attrs.displayMode ? 'width:140px;' : 'width:65px;'}"
styleClass="#{cc.attrs.styleClass} #{cc.attrs.calculated ? 'ui-state-calculated' : ''}"
placeholder="#{empty cc.attrs.calculatedValue ?
enumHelper.getDisplayValue('net.transdata.komalog.ui.converter.WeightUnit', cc.attrs.unit) :
weightToStringFormatter.getUntypedWeightAsString(cc.attrs.calculatedValue, cc.attrs.returnType, cc.attrs.unit)}"
title="#{empty cc.attrs.calculatedValue ?
cc.attrs.tooltip :
cc.attrs.calculatedLabel.concat(': ').concat(weightToStringFormatter.getUntypedWeightAsString(cc.attrs.calculatedValue, cc.attrs.returnType, cc.attrs.unit))}"
onChange="#{cc.attrs.onChange}" >
<td:weightConverter weightUnit="#{cc.attrs.unit}" returnType="#{cc.attrs.returnType}" />
</p:inputText>
</div>
</composite:implementation>
Using
Primefaces 11.0.1
Extensions 11.0.4
Mojarra 2.3.14.SP01
Wildfly 21.0.2.Final
Primefaces 11.0.1
Extensions 11.0.4
Mojarra 2.3.14.SP01
Wildfly 21.0.2.Final
OK I just did this creating an InputText with a Calculator and using the French locale and the separator is a comma ","....
Can you try that?
Code: Select all
<p:inputText id="pInputText" value="#{calculatorController.pInputText}" />
<pe:calculator for="pInputText" showOn="both" precision="2" locale="fr" />
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
Confirmed! It works with "fr". But not with "de" for instance.
But then there's still another problem: If set to "fr" and the input field contains a thousand separator let's say "5.000" for five thousand then the calulator shows up with a value of "5"!
--Heiko
But then there's still another problem: If set to "fr" and the input field contains a thousand separator let's say "5.000" for five thousand then the calulator shows up with a value of "5"!
--Heiko
Using
Primefaces 11.0.1
Extensions 11.0.4
Mojarra 2.3.14.SP01
Wildfly 21.0.2.Final
Primefaces 11.0.1
Extensions 11.0.4
Mojarra 2.3.14.SP01
Wildfly 21.0.2.Final
OK a couple of things.
1. You are right it looks like the german locale is using Decimal see here:
https://github.com/primefaces-extension ... ator-de.js
2. Looks like its a bug in the Keith Wood Calculator component as far as using both period and comma. You can report it here:
https://github.com/kbwood/calculator
1. You are right it looks like the german locale is using Decimal see here:
https://github.com/primefaces-extension ... ator-de.js
2. Looks like its a bug in the Keith Wood Calculator component as far as using both period and comma. You can report it here:
https://github.com/kbwood/calculator
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
-
- Information
-
Who is online
Users browsing this forum: No registered users and 0 guests