:: Forum >>

How to set fixed number of decimal digits?

Hello

I need to set a fixed number of decimal digits in a number format.

For example, display always 2 decimal digits:

1584215.5 ---> 1,584,215.50
152401 ---> 152,401.00
5112.52 ---> 5,112.52
0 ---> 0.00

I try to use the format #,###.## but it show differents style with each number above.

Thanks
Esteban
Wednesday, January 21, 2009
The format "#,###.##" should work exactly like you described -

http://www.activewidgets.com/aw.formats.number/settextformat.html

Alex (ActiveWidgets)
Thursday, January 22, 2009
Alex

I was checking my source code and found that the failure occurs when the data source array change and then refresh the grid.

The target array has the same structure as the original array.

If I remove the command x_grid.setCellText(array), it works correctly.

I used it that way because the array of data is loaded via AJAX.

Maybe this information will be useful for a possible correction.

Greetings
Esteban
Friday, January 23, 2009
I need to use the x_grid.setCellText() because if I don't update the grid with the records of receipt AJAX the grid don't show the new data. But if I use setCellText() formats are lost.

What should I do to fix this problem?

Thank you
Esteban
Friday, January 23, 2009
Ok, I found a solution.

Based on this post (http://www.activewidgets.com/javascript.forum.15965.1/date-formatting.html) I applied the obj.setCellData instead of obj.setCellText and works fine for me.

Greetings
Esteban
Monday, January 26, 2009

This topic is archived.


Back to support forum

Forum search