How can i do multi columns render ?

How can i do multi columns render ?

ziv@kpmbro.comziv@kpmbro.com Posts: 73Questions: 28Answers: 4

HI

I got this column render code in my table

  'aoColumnDefs': [{
    'targets': 0,
    'searchable': false,
    'orderable': false,
    'className': 'dt-body-center',
    'render': function(data, type, full, meta) {
      return '<input type="checkbox" name="id[]" value="' + $('<div/>').text(data).html() + '">';
    },
  }
  ]

and now i want to do a different rendering to a different columns(target), how can i do that?

i tried this

'aoColumnDefs': [{
    'targets': 0,
    'searchable': false,
    'orderable': false,
    'className': 'dt-body-center',
    'render': function(data, type, full, meta) {
      return '<input type="checkbox" name="id[]" value="' + $('<div/>').text(data).html() + '">';
    },{
    'targets': 3,
    'searchable': false,
    'orderable': false,
    'className': 'dt-body-center',
    'render': function(data, type, full, meta) {
      return '<input value="test">';
    },
  }
  ]

but it doesnt work :(

Thanks

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin
    Answer ✓

    What you have above should work as far as I can tell. If you link to a page showing the issue I'd be happy to take a look at it.

    Allan

This discussion has been closed.