Hi, I want to show checkboxes as my first cloumn in datatables, so i am using the plugin-

Hi, I want to show checkboxes as my first cloumn in datatables, so i am using the plugin-

Maggi12Maggi12 Posts: 3Questions: 1Answers: 0

plugin- datatables.select.min.js ,but its giving me an error: Uncaught TypeError: Cannot read property 'row' of undefined. The check is working but i can't uncheck the checkbox ,when i click on the checked checkbox. Can anyone help me on this.

thanks in advance

Answers

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    Can you show the code? and preferably throw it in a live DT example?

  • Maggi12Maggi12 Posts: 3Questions: 1Answers: 0

    Here is my code:
    function callable(d) {
    hideLoader();

    $(".menu-item span:last-child").removeClass("active-color");
    $("#Menu_Blocked_Users span:last-child").addClass("active-color");
    
    
    removeElement('tableDiv');
    $("body").off("click");
    
    var tableString = '';
    var tableString = '<table id="contactexample" class="display" width="100%">';
    tableString += '</tbody></table>';
    document.getElementById('blocked-user-table').innerHTML = tableString;
    var padding = '';
    if (deviceType === 'iPad') {
        padding = 'padding-bottom: 50%; margin-top: 0%; width:15%; height:15%;'
    }
    else if (deviceType === 'widescreen') {
        padding = 'padding-bottom: 50%; margin-top: -13%;';
    }
    else
    {
        padding = 'padding-bottom: 50%;';
    }
    
    var uri = '';
    if (UserId === 0) {
        uri = globals.servicePath + '/Demosvc/GetListing/' + sessionStorage.SessionId + '/1' + '/0';
    }
    else {
        uri = globals.servicePath + '/Demo.svc/GetListing/' + sessionStorage.SessionId + '/0/' + UserId;
    }
    
    var UserTable = $('#texample').dataTable({
    

    "bJQueryUI": true,
    "sScrollY": "572px",
    "sPaginationType": "full_numbers",
    "aLengthMenu": [50, 100],
    "iDisplayLength": 50,
    "bProcessing": true,
    "bDeferRender": true,
    "iDisplayEnd": 20,
    "StateSave": true,
    "ajax": function(data, callback, settings) {
    datatableAjaxRequest(callback, uri);
    },
    "columns": [
    {
    ```
    sWidth: "2%",
    data: null,
    defaultContent: '',
    className: 'select-checkbox',
    orderable: false,

            },
    
            {sWidth: "2%", sTitle: "", "data": "ImageString"},
            {sWidth: "15%", sTitle: "Contact Name", "data": "ContactName"},
            {sWidth: "10%", sTitle: "Company Name", "data": "CompanyName"},
            {sWidth: "15%", sTitle: "Address", "data": "Address"},
            {sWidth: "10%", sTitle: "Contact #", "data": "PhoneNumber"},
            {sWidth: "20%", sTitle: "Email ID", "data": "EmailID"},
            {sWidth: "2%", sTitle: "Contact ID", "data": "ContactID", "visible": false}
        ],
        "order": [1, 'asc'],
    
        select: {
            style: 'multi',
            selector: 'td:first-child'
        },
      ```
        "oLanguage": {
            "sInfoEmpty": 'No matching records found to list.',
            "sEmptyTable": "No matching records found to list.",
            "sSearch": "",
            "sLoadingRecords": "<div class=\"loader \"><img src='images/general/ajax-loader.gif'  style=\'" + padding + "'\"></div>",
        },
        "aoColumnDefs": [{
                "aTargets": [2],
                "mRender": function(data, type, full) {
                    if (data === '') {
                        return '';
                    }
                    else
                        return '<a href="#">' + data + '</a>';
                }
            }],
    
  • Maggi12Maggi12 Posts: 3Questions: 1Answers: 0

    Here is my code and i want it to support multiple checkbox selection.

This discussion has been closed.