Digit number and two characters after the point

Digit number and two characters after the point

mosxemosxe Posts: 4Questions: 2Answers: 0
edited October 2017 in Free community support

Hello, friends.
I have one problem. I have numbers, for example: 2529770.203 (455212.1015) etc.
I need to add a bit between them and leave two characters after point. For exanple: 2 529 770.20 (455 212.10) etc.
While i stopped at this:
$(td).text($(td).html().replace(/\B(?=(\d{3})+(?!\d))/g, " ").replace(',','.'));
DEMO: https://jsfiddle.net/mosxe/teanhtyh/
Where $(td).text() i get a number from the cell of the row in the table.
What I need to do leave two characters after the point?
Ps. there is another option: it sorts the numbers correctly, but when the columns are dynamically loaded through ajax, the formatting function reaches the first space and discards all other numbers, for example: 202001 ---- 202 001 ----- 202
DEMO1: https://jsfiddle.net/mosxe/teanhtyh/1/
But here the columns are static and everything works fine, but with dynamic alas....
Thank you in advance

This discussion has been closed.