thousand separator
thousand separator
eastofthesun
Posts: 12Questions: 4Answers: 0
hi
I have a column with numbers like:
1
1000
1100
how can I display them with thousand separator (not changing the original format) as:
1
1 000
1 100
This discussion has been closed.
Answers
Take a look at the Editor examples which use a number rendering formatter that is built into DataTables:
{ data: "salary", render: $.fn.dataTable.render.number( '\'', '.', 0, '$' ) }
.Allan
thanks allan
look at it but don't really get a grip on it...can you show a complete code how you do it on a column?
thanks
The complete code is there in the example :-). The first parameter is the thousands separator, the second the decimal place, the third the number of decimal places and the last (optionally) a currency symbol.
Allan
ok =), tried this without success...
Presumably you are getting syntax errors using that? The
columns
array should be in the DataTables constructor object andfields
in the Editor constructor object.Allan
ok, but do you need to use the editor object to get thousand separator like I want, there is no other way?
I don't understand? You use the line that I referenced in the DataTables initialisation. That it was in an Editor example is inconsequential - you can ignore that fact. Unless you are using Editor, just look at how DataTables initialised in that example.
Allan
Hi again Allan
http://live.datatables.net/paqebej/1/
How do I get thousand separator on the data (1000000) without changing the original data?
The left column that is fixed is missing the zebra coloring and does not change color on mouseover on the column 2 or higher, how can this be solved?
The columns sorting arrows are getting too close on the header...how can I adress this?
Thanks in advance for your help!
Your code shows no attempt to do what Allan has already explained to you twice. Also, why are you initializing your "var table" twice with different table id's?
Hi Tangerine
Thanks for you response. Can you please refer in code where its done twice?
Hi all,
I've tried use jQuery.fn.dataTable.render.number( '.', ',', 2, '' ), it works fine for thousand separator but for decimal it doesn't work: I've tried other characters but it show always the dot.
I use version 1.10.0
Can you help me?
thanks
@adefaveri - Please link to a test case showing the problem.
Allan
hi allan,
I can't... it is a not public project.
I can show this: https://www.dropbox.com/s/s61myz5xonx8dst/2014-06-09_1423.png
Thanks for the screenshot! Very certainly a bug in DataTables. I've committed the fix here and it will be in 1.10.1.
Until then, you can grab the nightly if you want to try out the very latest with this fix.
Regards,
Allan