Filter Only Searches Visible Fields

Filter Only Searches Visible Fields

ajmartinajmartin Posts: 4Questions: 2Answers: 0

Hi All

I have created a data table, but the filter field is only searching the visible text not the full contents of the 5 column "Description". Is there a way I can improve the filter to search all of the content.

var myTable = $('#myTable').dataTable({
"bStateSave": true,
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"order": [],
"aoColumns": [
{ "bSearchable": true, "bSortable": true, "iDataSort": 8 },// Contact Name
{ "bSearchable": true, "bSortable": true },// Group Contact Name
{ "bSearchable": true, "bSortable": true },// Category
{ "bSearchable": true, "bSortable": true, "iDataSort": 9 }, // Date
{ "bSearchable": true, "bSortable": true, "iDataSort": 10 }, // Follow Up
{ "bSearchable": true, "bSortable": true }, // Description
{ "bSearchable": true, "bSortable": false }, // Go to link
{ "bSearchable": true, "bSortable": false }, // Batch edit checkbox
{ "bSearchable": false, "bVisible": false }, // hidden contact name, for sorting
{ "bSearchable": false, "bVisible": false }, // hidden date open, for sorting
{ "bSearchable": false, "bVisible": false }, // hidden follow up date, for sorting
{ "bSearchable": true, "bSortable": false }, // hidden for enquiryno
],
});

Answers

  • kthorngrenkthorngren Posts: 20,299Questions: 26Answers: 4,769

    This is a duplicate of this thread:
    https://datatables.net/forums/discussion/51896/filter-only-searches-searchable-fields#latest

    searching the visible text not the full contents of the 5 column "Description"

    Not sure I fully understand what you mean by visible text. Are you saying the displayed text in a particular cell is a subset of the full text within the cell? Or that the search is only searching the displayed rows.

    In either case we will need more information about what is in the table and how it is populated. Looks like you are populating the table outside of Datatables.

    Can you post a link to your page or a test case replicating the issue?

    Kevin

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    Hi @ajmartin ,

    I'm not clear what you mean by the filter field is only searching the visible text of column 5. The standard search filter will filter all data from all searchable columns, whether the data is visible or not. Could you give some more explanation, please.

    Cheers,

    Colin

  • ajmartinajmartin Posts: 4Questions: 2Answers: 0

    Hi Kevin & Colin

    I have figured it out thanks.
    The text that was being displayed in the data table was being only partially rendered so the other text was not searchable. I have resolved this now but including the full text in a hidden column.

    Thanks again
    Andrew

This discussion has been closed.