adding actions to first column, works on every column except first?

adding actions to first column, works on every column except first?

gixxy22gixxy22 Posts: 15Questions: 7Answers: 1

Im trying to add an action column to the beginning of my columns, but this example doesnt appear to work for me when its in the first column, any other column is fine..?

this works

{data: "id"},
{
     data: null,
     className: "dt-center editor-delete",
     defaultContent: '<i class="fa fa-trash"/>',
     orderable: false
 },
 {data: "fieldName"},

however this doesnt..

{
     data: null,
     className: "dt-center editor-delete",
     defaultContent: '<i class="fa fa-trash"/>',
     orderable: false
},
{data: "id"},
{data: "fieldName"},

I get the following error:
DataTables warning: table id=fields_list - Unknown field: (index 0)

using editor with server-side processing, i have an extra <th></th> tag in the thead.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,531Questions: 1Answers: 10,475 Site admin
    Answer ✓

    I suspect you have server-side processing enabled in this use case? By default DataTables ordering is performed on the first column (order). But ordering can't be performed on a column which doesn't have any data - thus the error (other things can trigger it which is why it isn't a specific error message - but this is the most common).

    To resolve use order and specify the default ordering to happen on one of the other columns.

    Regards,
    Allan

  • gixxy22gixxy22 Posts: 15Questions: 7Answers: 1

    Ahhhhh! Excellent, thank you!

Sign In or Register to comment.