I'm trying to use a f:convertnumber in a datatable, for some kind of reason it never seems do anything with the convertNumber in the datatable.
Below a piece of the datatable and the associated java program.
The preceding outputtext (employee.number) works fine, but the inputtext in the dataTable isn't working.
Has anybody an idea what the reason is ??
We have a "Code" tag that can be used to preserve the formatting of your code when you post it. You can insert it by clicking the "Code" button that's in the row of buttons above the message editing area.
convertNumber does work on both input and output in datatables. Could you tell us what you mean when you say it "doesn't work"?
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Jan 11, 2010
Thanks Tim for your tip of the code tag, I changed my post immediately.
The problem is when I uses a convertNumber not in a datatable it works fine.
In the mentioned example the number is formatted as 123.456 based on the pattern '###.###'.
But when I try to use it in a datatable it simply seems to ignore the convertNumber.
The monthSalaries are presented in the way they are returned from the program (500050, 200000 and 150000) and not as 5000.50 2000.00 and 1500.00 which I expected from the pattern.
The pattern is not the problem (I uses the most crazy patterns) but it looks like the convertNumber isn't recognized, I uses inputText and ouputText tags both the same problem.
Will Wijgergangs wrote:I've tried it with returning a float and a double but I don't think this is the problem.
In my understanding the purpose of a pattern is to make up a String with a kind of format.
Not in this case. That's why it's called convertNumber. This particular converter isn't a generic String reformatter.
Joined: Jan 11, 2010
It works great thanks Tim !!
The bold word Number in your last post triggered me.
I did test with a float or double however I used the primitives which of course won't work.
So implementing a Float as returning type gives the desired result.