Checkbox selection ( showing on 2nd column)

Checkbox selection ( showing on 2nd column)

latinunitlatinunit Posts: 73Questions: 12Answers: 0

I've added the select checkbox, however is coming on the 2nd option, how do I make it display on the first column.

http://live.datatables.net/yohuzuke/3

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,342Questions: 26Answers: 4,954
    Answer ✓

    Its showing in the first column along with the names, which is what you have configured:

    { orderable: false,className: 'select-checkbox', targets:   0}
    

    I assume you are expecting it to be in a column by itself with the names being the second column. You will need to add a column using the columns option. Move what you have in columnDefs to the first column definition in columns. Like this:
    http://live.datatables.net/mobetuso/1/edit

    You will need to adjust your columnDefs.targets from [1,2,3,4] to [2,3,4,5] and change the initial order to column 1 as shown in the example.

    I also added this to clear the stateSave:

    $('#recipients').DataTable().state.clear();  
    

    So you may need to run the test case twice to see the changes or comment out stateSave: true.

    Kevin

  • latinunitlatinunit Posts: 73Questions: 12Answers: 0

    Thanks! you are a star

Sign In or Register to comment.