How to have all rows selected by default?

How to have all rows selected by default?

Hello,

I have a simple datatable with datatable.js and datatable select.js
I would like to have all the rows selected(checked) when the datatable is initialized.

Any easy method that I can call to get this donw?

I have the following code:
HTML:

<table id="hrm_search_attachment_list" class="display wrap" width="100%">
    <thead>
        <tr>
            <th></th>
            <th>FileName</th>
            <th>Type</th>
            <th>Filetype</th>
        </tr>
    </thead>
    <tfoot>
        <tr>
            <th></th>
            <th>FileName</th>
            <th>Type</th>
            <th>Filetype</th>
        </tr>
    </tfoot>
    <tbody id = 'hrm_result_att'>
        <tr>
            <td></td>
            <td>CV</td>
            <td>something1</td>
            <td>Senior Developer</td>
        </tr>
        <tr>
            <td></td>
            <td>CV2</td>
            <td>something</td>
            <td>Senior Developer</td>
        </tr>
    </tbody>
</table>

Javascript:

var hrm_attachment = $('#hrm_search_attachment_list').DataTable({       
        "lengthMenu": [
            [5, 10, 25, 50],
            [5, 10, 25, 50]
        ],
        columnDefs: [{
            orderable: false,
            className: 'select-checkbox',
            targets:   0
        }],
        select: {
            style:    'os',
            selector: 'td'
        },
        order: [[ 1, 'asc' ]]
}); 

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.