Searching by column, not working

Searching by column, not working

yeshuayeshua Posts: 2Questions: 1Answers: 0
edited August 2018 in Free community support

Hi, I'm having a problem with sending search values for columns, my function is like this:

$('#advSearchBut').click( function (){
        var searchVal = $('#statusFilter').val();
        $('#advSearch').DataTable().columns(0).search(searchVal).draw();
});

and my DataTAbleDeclaration like this:

$('#advSearch').DataTable({
            order: [2, 'desc'],
            lengthMenu: [[10, 25, 50, 100, 200, 500], [10, 25, 50, 100, 200, 500]],
            dom: 'Blfrtip',
            buttons: [
                {
                    extend: 'excelHtml5',
                    title: 'Advance Search Data',
                    text: 'Excel Export',
                    exportOptions: {
                        columns: [2, 3, 4, 5, 6]
                    }
                }
            ],
            filter: true,
            searching: false,
            processing: true,
            serverSide: true,
            scrollX: true,
            ajax: "controller?do=getAdvanceSearch&pro=" + proUid,
            columnDefs: [
                {
                    targets: [0, 1, 3],
                    visible: false
                }
            ],
            rowCallback: function (row, data, index) {
                $(row).data('APP_UID', data[0]);
                $(row).data('DEL_INDEX', data[1]);

                $(row).click(function () {
                    reloadFrame(true);
                    var appUid = $(this).data('APP_UID');
                    var index = $(this).data('DEL_INDEX');
                    hideAllSections();
                    document.getElementById('left-menu').style.display = 'none';
                    var code = "../psAcordaFunctions/cases_Open?APP_UID=" + appUid + "&DEL_INDEX=" + index + "&action=sent";
                    $('#frameCase').attr('src', code);
                    var iOS = !!navigator.platform && /iPhone|iPod/.test(navigator.platform);
                    if (iOS) {
                        $('#divCase').addClass('module');
                    }
                    showCase();
                });
            }
        });

I've read different answers about the same problem, but any one help me. Think I am using wrong the "dom". Could anyone please help me?

Answers

  • kthorngrenkthorngren Posts: 21,301Questions: 26Answers: 4,946

    Since you have serverSide enabled this:

    $('#advSearch').DataTable().columns(0).search(searchVal).draw();
    

    Will send a request to your server script to perform the search. Is your server script setup to support column based searching?

    Kevin

This discussion has been closed.