datatable search button next to filter text box, move search to top left

datatable search button next to filter text box, move search to top left

geekpeekgeekpeek Posts: 3Questions: 2Answers: 0

i have seen this question was discussed before in the forum but didn't see any solution.

1) is there any way i can "Search" button next to default filter box and remove the "Search" label in front

2) also want to move the filter on top left side instead of default top right location. i have tried the following solution using sDom, but didn't work . Here is my code

    $('#patientDataTable').dataTable({
        "pagingType": "simple_numbers",
         "sDom": '<"pull-left"f><"pull-right"l>tip',
         "iDisplayLength": 10,
         language: {
                        paginate: {
                            next: '<img src="../../Content/DataTables/images/details_close.png" />',
                            previous: '<img src="../../Content/DataTables/images/details_open.png" />'
                        },
                        searchPlaceholder: "Name or MRN"
         }
    });

appreciate your help

Answers

  • jr42.gordonjr42.gordon Posts: 305Questions: 2Answers: 49

    The HTML for the search field is

    <div id="DataTables_Table_0_filter" class="dataTables_filter">
         <label>Search:<input type="search" class="" placeholder="" aria-controls="DataTables_Table_0"></label>
    </div>
    

    I solved this by adding my own styling

    .dataTables_filter {
        float: left;
    }
    
This discussion has been closed.