single align column

single align column

acarlomagnoacarlomagno Posts: 17Questions: 3Answers: 0

Hello,
I have tried the bootstrap.html server side example ... I need to align right only "salary" column.

I have inserted this code in style tag ...

example td { text-align: right; }

but this aligns all columns .. Can you help me ?

Antonello

Replies

  • tester1tester1 Posts: 53Questions: 14Answers: 1

    something may be : http://datatables.net/forums/discussion/456/aocolumns-with-multiple-arguments

    $('#example').dataTable({  
                        
                        "aoColumns": [                           //Row control
                      
                            { "firstname": "firstname" , "sClass": "center"},
                            { "salary": "salary" , "sClass": "right" },
      
                        ]
                    });
    
  • allanallan Posts: 61,821Questions: 1Answers: 10,127 Site admin

    I'd suggest adding a class to the column you want to align right. If you can't do it in HTML then use columns.className to add it. Then use CSS to align right the text for that class.

    Allan

  • acarlomagnoacarlomagno Posts: 17Questions: 3Answers: 0

    thanks to all

    I use this:

    { data: "salary", render: $.fn.dataTable.render.number( '.', ',', 2, '' ),"sClass": "salaryright" }

    and style

    .salaryright { text-align: right; }

    Antonello

This discussion has been closed.