Change the text label for the table filter (aka Search)?

Change the text label for the table filter (aka Search)?

logopogologopogo Posts: 2Questions: 1Answers: 0

Is it possible to change the text label for the table filter (aka Search) from "Search:" to something else (ie: "Filter:" or "Quick Search:" etc...)?
I want to see if there is a way via the dataTable options before I try to hack it with jQuery or a regExp.

The closest thing I can find is the DOM option, but this looks to only be for element ordering and to create general wrapper elements around them - not to customise the actual markup of the elements themselves.

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
     "oLanguage": {
        "sSearch": "your-text-here"
      }
    
  • logopogologopogo Posts: 2Questions: 1Answers: 0

    Thanks tangerine.

    Can I ask why the preceding 'o' and 's' before the option names?

    And what is the correct way to implement this if I have other options assigned? Is the following correct:

    $('#clientTable').DataTable({

    "stateSave": true,

    "dom": "fltpi",

    "columnDefs": [

    { "orderable": false, "targets": [0, 5] }

    ],

    "oLanguage": {

    "sSearch": "Quick Search:"

    }

    });

    It seems to work ok but now I have an issue with my 'columnDefs'

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Can I ask why the preceding 'o' and 's' before the option names?

    o for object, s for string. Google "Hungarian notation".

    It seems to work ok but now I have an issue with my 'columnDefs'

    What "issue"?

  • allanallan Posts: 63,677Questions: 1Answers: 10,497 Site admin

    Have a look also at language and language.search which are the new camelCase notation for those parameters which is preferred in the documentation.

    Allan

This discussion has been closed.