Unable to show the check box and get the selected rpw data

Unable to show the check box and get the selected rpw data

cvinharcvinhar Posts: 1Questions: 1Answers: 0

Greetings,

I have been trying to enable check box in the data table and get the data of the selected row but I'm unable to do it I will provide the code I developed to initialize the table

function initialDetailsModal(RowId) {        
    var optionsOverride = ""
    var title = "Requirements";
    optionsOverride = $.extend(true, {}, {
        buttons: [
                 $.extend(true, {}, CustomExportForLink, {
                     extend: 'copyHtml5',
                     title: "Requirements Details"
                 }),
                 $.extend(true, {}, CustomExportForLink, {
                     extend: 'csvHtml5',
                     title: "Requirements Details"
                 }),
                 $.extend(true, {}, CustomExportForLink, {
                     extend: 'pdfHtml5',
                     title: "Requirements Details"
                 })
        ]
    });
    optionsOverride.order = [[7, "desc"]];
    for (var k in optionsOverride.buttons) {
        if (optionsOverride.buttons[k].title !== undefined) {
            optionsOverride.buttons[k].title = title;
        }
    }
  //  self.DetailsDataTable = initDataTable("#DetailsTable", optionsOverride);

    var options = {
        sDom: "<'dt-toolbar'<'col-xs-12 col-sm-7 hidden-xs'f><'col-xs-12 col-sm-2 hidden-xs'l><'col-xs-12 col-sm-3 hidden-xs'B>r>" +
            "t" +
            "<'dt-toolbar-footer'<'col-sm-6 col-xs-12 hidden-xs'i><'col-xs-12 col-sm-6'p>>",
        buttons: $.extend({}, datatableButtonsTemplate),
        sPaginationType: "full_numbers",
        autoWidth: true,
        responsive: true,
        aLengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
        pageLength: 10,
        columnDefs: [{
            targets: 1,
            //createdCell: createdCell
            'checkboxes': {
                'selectRow': true
            }
        }],
        'select': {
            'style': 'multi'
        },
    }
    if (optionsOverride) {
        $.extend(options, optionsOverride);
    }
    return $("#DetailsTable").DataTable(options);


    //clear previous listeners
    $("#DetailsTable thead tr th input[type=text]").off("keyup change");
    //for column search
    $("#DetailsTable thead tr th input[type=text]").on("keyup change", function () {
        var idx = $(this).parent().index();
        self.DetailsDataTable.column(idx).search(this.value).draw();
    }); 
}

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    This example shows how to get the selected rows when using the Select Extension.

    Kevin

Sign In or Register to comment.