Error using formatNumnber function with 3 params

asked 2021-05-19 15:53:32 +0800

jballesteralejo gravatar image jballesteralejo

updated 2021-05-19 16:08:00 +0800

When I call the function in label value="${c:formatNumber(each.price, null,null))}, ZK returns back an error:

The function 'c: formatNumber' specified 2 parameters, but 3 were declared

But in the commonsFns there is the next function: formatNumber(java.lang.Object number, java.lang.String pattern, java.util.Locale locale) Formats a number (Integer, BigDecimal...) into a string.

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted

answered 2021-05-20 12:41:12 +0800

hawk gravatar image hawk
2837 1 5
http://hawkphoenix.blogsp... ZK Team

updated 2021-05-20 12:44:57 +0800

It's a bug, thank you for reporting this problem. Please find a workaround at https://tracker.zkoss.org/browse/ZK-4902

But according to your code ${c:formatNumber(each.price, null,null)} You pass null as the 3rd parameter, you can just call with 2 parameters:

${c:formatNumber(each.price, null)}

Ref doc: ZUML Reference / formatNumber

link publish delete flag offensive edit

answered 2021-05-26 09:27:56 +0800

hawk gravatar image hawk
2837 1 5
http://hawkphoenix.blogsp... ZK Team

you can also declare the method with 3 parameters as a xel method then call it.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2021-05-19 15:53:32 +0800

Seen: 8 times

Last updated: May 26

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More