Requested unknown parameter error with createdCell in conjunction with render

Requested unknown parameter error with createdCell in conjunction with render

dentner@live.comdentner@live.com Posts: 2Questions: 1Answers: 0
edited March 2017 in Free community support

Hey,

I am getting a "Requested unknown parameter '0'" error when I use render to output a checkbox, and then use created cell to add scope="row". The error makes me think that the createdCell might be firing before render since that error seems to think that there isn't data for column 0. Render is taking care of putting "data" in that cell so I'm not sure why the error is occurring.

columns: [
 {
     targets: 0,
     searchable: false,
     orderable: false,
     width: '1%',
     className: 'dt-center',
    render: function (data, type, full, meta) {
         return '<input type="checkbox">';
     },
     createdCell: function (td, cellData, rowData, row, col) {
         $(td).prop("scope", "row");
     }
 },
 {
     targets: 1,
     data: 'PriorityDesc'
 },
 {
     targets: 2,
     data: 'ReviewDesc'
 },
 {
     targets: 3,
     data: 'ReviewReasonId',
     visible: false,
     searchable: false
 }
],

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,871Questions: 1Answers: 10,525 Site admin
    Answer ✓

    Add: data: null to your first column to tell DataTables not to try and source the data from anywhere. Otherwise it will use the column index (0 in this case).

    Allan

  • dentner@live.comdentner@live.com Posts: 2Questions: 1Answers: 0

    That did the trick. As it turned out I needed data for the column anyway to determine if I should render the checkbox as already checked. Thanks!

This discussion has been closed.