Uncaught TypeError: rows(...).select is not a function

Uncaught TypeError: rows(...).select is not a function

SirRalphSirRalph Posts: 2Questions: 1Answers: 0

Link to test case: N/A
Debugger code (debug.datatables.net): uploaded the configuration but got "This page isn’t working" in response

    var SelectionMode = GetSelectionMode();
    var oTableMultiselect = $("#tblMultiSelect").dataTable({ "bFilter": false,
        "bInfo": false,
        "aoColumns": [{ "bVisible": false }, null, { "bVisible": false }, null, null], //This is to hide columns
        "aaSorting": [[0, "asc"]],
        "bScrollInfinite": true, //this property disables pagination
        "sScrollY": "110px", //230px to test with larger list
        "bDestroy": true,
        "sDom": 'T<"clear">lfrtip',
        "bLengthChange": false,
        "bPaginate": false,
        "select": SelectionMode
    }).rowGrouping({
        bExpandableGrouping: true,
        iGroupingColumnIndex: 1,
        iGroupingOrderByColumnIndex: 1
    });

function fnSelectAll() {

    if ($("input[id$='hfSelectionType']").val() == "orgs") {
        var initContainer = document.getElementById('tblMultiSelect');
        var inputTags = initContainer.getElementsByTagName('input');
        for (var i = 0; i < inputTags.length; i++) {
            if (inputTags[i].id.indexOf('chk') != -1) {
                $(inputTags[i]).prop('checked', true);
            }
        };
        GetSelectedOrgs();
    }
    else {
        var oTT = $('#tblMultiSelect').dataTable().api();  //oTT = _Api {context: Array(1), selector: {…}, tables: ƒ, table: ƒ, draw: ƒ, …}
        oTT.rows().select();   //error thrown here: Uncaught TypeError: oTT.rows(...).select is not a function
        //oTT.row(1).remove().draw();   this works

        var selectAll = -1; //ALL option 
        $("input[id$='hfMultiSelected']").val(selectAll);
    }
    $('[id$=lnkSelectAll]').hide();
    $('[id$=lnkDeSelectAll]').show();
}

Error messages shown: Uncaught TypeError: oTT.rows(...).select is not a function
Description of problem:

Using DataTables 1.10.21
jquery.dataTables.rowGrouping 1.2.11

Trying to select all rows in the datatable when a "Select All" button is clicked - this was working with the previous libraries (pre-1.10)
I would like to still use the rowGrouping library with the latest DataTable libraries.
Using $().DataTable() does not work with rowGrouping hence still using $().dataTable().

Any assistance will be greatly appreciated.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    edited June 2020 Answer ✓

    Select extension is an extension like RowGroup, so you'll need to include those additional files too,

    Colin

  • SirRalphSirRalph Posts: 2Questions: 1Answers: 0

    Thank You @colin! That is what was missing. I thought it already came with the main library, Cheers!

This discussion has been closed.