ADD non-numeric characters in numbers
ADD non-numeric characters in numbers
Hi Allan!
Here
http://www.datatables.net/plug-ins/sorting
I could find to avoid the "non-numeric" characters in numbers. But I'd like to have it vice-versa:
For example: "1000000" should be displayed as "1.000.000" and (of course) should be sortable, too.
Is there still a way and I couldn't get the line? If not, it would be great to add it to your to-do-list! :-)
Greetz from Berlin
Sebastian
Here
http://www.datatables.net/plug-ins/sorting
I could find to avoid the "non-numeric" characters in numbers. But I'd like to have it vice-versa:
For example: "1000000" should be displayed as "1.000.000" and (of course) should be sortable, too.
Is there still a way and I couldn't get the line? If not, it would be great to add it to your to-do-list! :-)
Greetz from Berlin
Sebastian
This discussion has been closed.
Replies
Yes this is quite possible. You can populate your table with numbers and then have DataTables format it as you require with fnRender ( http://datatables.net/ref#fnRender ). You can also maintain the sorting by telling DataTables to use the original value rather than the rendered one with bUseRendered:false ( http://datatables.net/ref#bUseRendered ).
Allan
if I put this
[code]"fnFormatNumber": function ( iIn ) {
if ( iIn < 1000 ) {
return iIn;
} else {
var
s=(iIn+""),
a=s.split(""), out="",
iLen=s.length;
for ( var i=0 ; i
[quote]{ "sName": "Number", "sTitle": "Number", "bSearchable": false, "fnRender": function ( oObj ) { return '' + oObj.aData[6] +''; }, "aTargets": [ 6 ], "sType": "num-html", "asSorting": [ "desc" ] },[/quote]
And the number ("6") I'd like to format it like "1.000.000" or something like this. For sure not the link sourrounding it ;-)
Allan
I'have added this
[code] "fnFormatNumber": function ( iIn ) {
if ( iIn < 1000 ) {
return iIn;
} else {
var
s=(iIn+""),
a=s.split(""), out="",
iLen=s.length;
for ( var i=0 ; i
The function:
[code] "fnFormatNumber": function ( iIn ) {
if ( iIn < 1000 ) {
return iIn;
} else {
var
s=(iIn+""),
a=s.split(""), out="",
iLen=s.length;
for ( var i=0 ; i
Allan
Allan
So HOW I do add this function and finally how to format the long numbers? I still don't get it.
Sebastian