How in can add new column to row

How in can add new column to row

kise97kise97 Posts: 1Questions: 1Answers: 0
edited July 2014 in Free community support

I have this data

[
  {
    id: 1,
    name: 'first',
    desc: 'mini desc'
  }, 
  {
    id: 2,
    name: 'second',
    desc: 'mini desc'
  }
]

If i create datatable with this data i get this

+----+--------+-------------+
+ ID + Name   + Description +
+----+--------+-------------+
+ 1  + first  + mini desc   +
+----+--------+-------------+
+ 2  + second + mini desc   +
+----+------+---------------+

But i want result like this

+---+----+--------+-------------+
+ * + ID + Name   + Description +
+---+----+--------+-------------+
+ * + 1  + first  + mini desc   +
+---+----+--------+-------------+
+ * + 2  + second + mini desc   +
+---+----+--------+-------------+

* - checkbox input

I know, that i can do it with replace data of column, but i want save all columns

createdRow: function (row, data, index) {
    $('td', row).eq(0).html('<input type="checkbox">')
}

How i can do it without replace data column ? Thanks.

Answers

  • DaimianDaimian Posts: 62Questions: 1Answers: 15

    Personally I would use columns.render to turn the column into a checkbox.

    Hopefully this will lead you in the right direction.

This discussion has been closed.