Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82411

Server side processing not searching specific column

$
0
0

Hi, i have a server side enabled datatable. I can search by other columns except one of the columns status_name

The implementation code is as follows.

// DB table to use | Use a subquery as table
        $subQuery = "select table1.id,.......
                    , ifnull(table2.id, 2) as processing_status
                    , ifnull(table2.description, 'Pending') as processing_status_name
                    from table1
                    left join table2 .................
                    ......................................
                    where ..... order by table1.created desc";
        $table = "($subQuery) AS table1";

        // Table's primary key
        $primaryKey = 'id';

        $columns = array(
            ..................................................................,
            array('db' => 'processing_status_name', 'dt' => 9),
            array('db' => 'processing_status', 'dt' => 10),
            array('db' => 'id', 'dt' => 11),
            array('db' => 'application_id', 'dt' => 12)
        );

        return SSP::complex($_GET, $this->em->getConnection(), $table, $primaryKey, $columns, null, null);

Here is the datatable initialization

<table id="records-datatable"
                           class="table cell-border hover stripe app-table app-table-clickable">
                        <thead>
                        <tr>
                            <th>Serial#</th>
                            <th>Number</th>
                            <th>Surname</th>
                            <th>Firstname</th>
                            <th>Mobile Number</th>
                            <th>Date of Birth</th>
                            <th>State</th>
                            <th>CNT</th>
                            <th>Expiry Date</th>
                            <th>Processing Status</th>
                            <th>Actions</th>
                        </tr>
                        </thead>
                        <tfoot>
                        <tr>
                            <th>Serial#</th>
                            <th>Number</th>
                            <th>Surname</th>
                            <th>Firstname</th>
                            <th>Mobile Number</th>
                            <th>Date of Birth</th>
                            <th>State</th>
                            <th>CNT</th>
                            <th>Expiry Date</th>
                            <th>Processing Status</th>
                            <th>Actions</th>
                        </tr>
                        </tfoot>
                    </table>
recordsDataTable = $('#records-datatable').DataTable({
                "processing": true,
                "serverSide": true,
                "ajax": ".....................",
                "deferRender": true,
                "order": [],
                "pageLength": 25,
                "language": {
                    "emptyTable": "No matching records found",
                    "processing": '<div class="spinner-border text-dark mt-2 mb-2" role="status">\n' +
                        '  <span class="sr-only">Loading...</span>\n' +
                        '</div>'
                },
                "columnDefs": [
                    {
                        "targets": -1,
                        "data": null,
                        "orderable": false,
                        "render": function (data, type, row, meta) {
                            return '<div class="dropdown app-dropdown-md dropright">\n' +
                                '  <button class="btn btn-primary app-btn-xs dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">' +
                                '    Action' +
                                '  </button>' +
                                '  <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">' +
                                '    <a class="dropdown-item app-fancybox-iframe" href="' + recordDetailUrl + '?q=' + data[12] + '">Record Details</a>' +
                                '  </div>' +
                                '</div>';
                        }
                    }
                    , {
                        "targets": -2,
                        "data": null,
                        "render": function (data, type, row, meta) {
                            let badgeType = (data[9] === "Pending") ? 'danger' : 'success';
                            return '<span class="badge badge-' + badgeType + ' tx-white">' + data[9] + '</span>';
                        }
                    }
                ]
            });

I cannot search by the processing status column. It returns 0 records when i do


Viewing all articles
Browse latest Browse all 82411

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>