jQuery Datatables align center 1 column

前端 未结 4 1448
太阳男子
太阳男子 2021-02-05 02:51

Want to align center just the first column called \"Status\":

        $(\"#TransactionTable\").DataTable({
            ajax: {
                url: \'/Transactio         


        
4条回答
  •  长发绾君心
    2021-02-05 03:31

    You can use your theme classes (bootstrap), or your own in columndef. like

    text-right, text-left,text-center

     'columnDefs': [
      {
          "targets": 0, // your case first column
          "className": "text-center",
          "width": "4%"
     },
     {
          "targets": 2,
          "className": "text-right",
     }],
    

提交回复
热议问题