When we need to convert ‘Number’ values in the front-end, we have the standard:
<af:convertNumber />
But we want a custom converter for the number values in the application.
To do this for the whole application, we need to adjust the jag-config.xml.
1. Go to ViewController > Resources > config and open jag-config.xml.
2. Search for property name=”libraries” under this property you will find
<value>default/common/common_items.vm</value>
3. Replace this one with a custom reference e.g.
<value>UrgencyRequest/common/demo_items.vm</value>
4. Next is to make this new demo_items.vm template and copy the content from the original common_items.vm template to the new template.
5. Search for #macro (NUMBER_CONVERTER) and insert a custom converter:
<f:converter binding=”#{DemoNumberConverter}” />
Example:
#macro (NUMBER_CONVERTER)
#if(${JHS.current.item.numberItem})
<f:converter binding=”#{DemoNumberConverter}” />
#end
#end