Search not working when first column is a checkbox

Search not working when first column is a checkbox

MundaringMundaring Posts: 34Questions: 12Answers: 1

Hi,

I am having an issue when my first column is a checkbox, and data = null, search stops working and throwing an error (image attached)

It needs to associate a value in the data for that particular column to make it works, but I do not want to display any information in that column just the checkbox . I have done this in previous versions and it worked perfect. at the moment I am using Editor Data Tables v1.6.1.0

I tried a trick using CSS to make text in that column transparent, but the problem is the check became also transparent.

How could I solve this?

Thanks in advance for any help provided,

Wilson

Code

var table = $('#tblList').DataTable({
            "idSrc": "ParcelNumber",
            "searching": true,
            "bPaginate": true,
            "bInfo": true,
            //"bAutoWidth": true,
            "processing": true,
            "serverSide": true,
            "iDisplayLength": 20,
            "pagingType": "full_numbers",
            "aLengthMenu": [[10, 20, 50, 100], [10, 20, 50, 100]],
            "ajax": {
                "url": "/Locations/DTIndex",
                "type": "POST"
            },
            columns: [
                {
                    data: null,//"ParcelNumber",
                    defaultContent: '',
                    className: 'select-checkbox',
                    orderable: false,
                    visible: false
                },
                { data: "ParcelNumber" },
                { data: "StreetDetailsToSearch" },
                { data: "Suburb" },
                {
                    data: "PropertyArea", className: "tdFixedWidth120 alignRight",
                    render: function (data, type, row) {
                        return numberFormat(data);
                    }
                }
            ],
            order: [1, 'asc'],
            keys: {
                columns: ':not(:first-child)',
                keys: [9]
            },
            select: {
                style: 'os',
                selector: 'td:first-child'
            },
            rowCallback: function (row, data) {
                $(row).addClass('trLink');          //When the row has a link
            }
        });

Answers

  • MundaringMundaring Posts: 34Questions: 12Answers: 1

    Hi,

    I solved the issue updating to version 1.6.3

    Wilson

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Thanks for the update - good to hear you have it working now. It would also be worth adding columns.searchable and setting it to be false for your first column.

    Allan

This discussion has been closed.