How can I set alignment of columns to right ?
How can I set alignment of columns to right ?
gopi.jtech@gmail.com
Posts: 9Questions: 3Answers: 0
I want to align the column to right for numbers How can I do it ? I seen this link from here but its not working for me.
https://datatables.net/forums/discussion/comment/139922/#Comment_139922
Is there any other way.
Answers
This example is from that thread, and it appears to be working as expected. Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.
Cheers,
Colin
Thank you for the response, Yes I will check this and revert back asap.
This will work only on screen .. I am extending a button to export data as JSOn and send to a notepad for text printing
{
extend: 'copy',
text: 'Print',
action: function ( e, dt, button, config ) {
var data = dt.buttons.exportData(
{
columnDefs: {targets: [3,4], className: 'numberColumn'}
}
);
var jsonData = JSON.stringify( data ) ;
doPrint(data);
}
}
in my notepad it always come without any text-align ?!
The alignment is done on the table with classes - you're just exporting the data which doesn't have an alignment, it's just a number.
Colin
is it possible to export data with alignment ? if possible how can I do it ? thank you for the help.
The above code works perfect with alignment for csv,excel, pdf but not for the extended button. Is it possible to do that. Please help me, thanks in advance.
Please see my last message, the same applies. It's just a string, without indentation. You could pad it with spaces, but that's the best you'll get.
Colin