Multiple columns definition with the same code

Multiple columns definition with the same code

itajackassitajackass Posts: 162Questions: 48Answers: 3
edited January 2018 in Free community support

I've another question. In different tables i've columns with date inside, and I implement this to do the correct ordering. See example above with 3 columns with date.

Sometime the customer tell me do insert/remove a columns of data, then i've to manually correct columnDefs to increase/decrease the indexes. Is there a way to prevent this manually checks every time I insert or remove a column and use a "global" targets so i can shrink also the columnDefs option to 1 array entry instead of 3 in this case?

  "columnDefs": [
   {
       targets: [0],
      data: {
        _: "0.display",
        sort: "0.@data-order",
        type: "0.@data-order"
     }
  },
 {
    targets: [3],
    data: {
        _: "3.display",
        sort: "3.@data-order",
        type: "3.@data-order"
      }
  },
  {
    targets: [4],
    data: {
        _: "4.display",
        sort: "4.@data-order",
        type: "4.@data-order"
      }
   }
 ]
This discussion has been closed.