How to display the work “Search” before the search field in datatable jquery and bootstrap

前端 未结 2 1801
一个人的身影
一个人的身影 2021-01-23 14:17

I am using bootstrap datatable feature to display the table in the screen. For some reason, the word SEARCH is not shown before the search field. I do not know where I am wrong.

相关标签:
2条回答
  • 2021-01-23 14:41

    In following the doc I hope it will work...

    The doc : http://datatables.net/reference/option/language.search

    Extract :

    $('#example').dataTable( {
      "language": {
        "search": "Filter records:"
      }
    } );
    
    0 讨论(0)
  • 2021-01-23 15:00

    Thanks everyone for answering my questions...

    I did some more research on datatable and found out that the default values provided by bootstrap-datatables were modified.The oLanguage attribute of datatable has the ability to customize your word. Initially, the value for sSearch was bland and I change it to Search. Now, wherever I use the datatable, the search keyword appears without adding any extra line in the respective JS. Below is an extra of bs3.datatables.js

    (function ($) {
    /* Set the defaults for DataTables initialisation */
    $.extend( true, $.fn.dataTable.defaults, {
        "sDom": "<'row'<'col-sm-12'<'pull-right'f><'pull-left'l>r<'clearfix'>>>t<'row'<'col-sm-12'<'pull-left'i><'pull-right'p><'clearfix'>>>",
        "sPaginationType": "bs_normal",
        "oLanguage": {
            "sLengthMenu": "Show _MENU_ Rows",
            "sSearch": "Search"
        }
    } );
    
    0 讨论(0)
提交回复
热议问题