Multiselect rows without CTRL key

Multiselect rows without CTRL key

Restful Web ServicesRestful Web Services Posts: 202Questions: 49Answers: 2
edited October 2014 in Free community support

Hi,

I apologies if this is a basic question but I cant seem to find the solution at the moment. I am using DataTables with the Editor plugin. All is working nicely except I would like to make it easier to select multiple rows at once. It is no problem if you hold the CTRL key on the keyboard, however can someone point me in the right direction so that I can achieve multiselect of rows without having to hold the CTRL key, by mouse click alone?

It seems to be quite straightforward here,
http://www.datatables.net/examples/api/select_row.html

However, I am using the editor plugin and wonder if this is causing a conflict?

Presently my js looks like this,

<script type="text/javascript">  
(function($){
$(document).ready(function() {
    var editor = new $.fn.dataTable.Editor( {
        "ajax": "/uploads/js/datatables/php/table.cms_module_tps_userlisting.php",
        "rowCallback": function( row, data ) {
            if ( $.inArray(data.DT_RowId, selected) !== -1 ) {
                $(row).addClass('selected');
            }
        },
        "table": "#cms_module_tps_userlisting",
        "fields": [
            {
                "label": "Number",
                "name": "listphone",
                "type": "text"
            },
            {
                "label": "Added",
                "name": "create_date",
                "type": "text"
            },
            {
                "label": "Test Result",
                "name": "checkcode",
                "type": "text"
            },
            {
                "label": "User",
                "name": "user_id",
                "type": "text"
            }
        ]
    } );
    
    // Activate an inline edit on click of a table cell
    $('#cms_module_tps_userlisting').on( 'click', 'tbody td:not(:first-child)', function (e) {
        editor.inline( this );
    } );

    $('#cms_module_tps_userlisting').dataTable( {
        "dom": "Tfrtip",
        "ajax": "/uploads/js/datatables/php/table.cms_module_tps_userlisting.php",
        "lengthMenu": [ [50, 100, 500, -1], [50, 100, 500, "All"] ],
        "columns": [
        { data: null, defaultContent: '', orderable: false },
            {
                "data": "listphone"
            },
            {
                "data": "create_date"
            },
            {
                "data": "checkcode"
            },
            {
                "data": "user_id"
            }
        ],
        "tableTools": {
            "sRowSelect": "os",
            "sRowSelector": 'td:first-child',
            "aButtons": [
                { "sExtends": "editor_edit",   "editor": editor },
                { "sExtends": "editor_remove", "editor": editor }
            ]
        }
    } );
} );
}(jQuery));
</script>

Thanks

Chris

This discussion has been closed.