Okay
  Public Ticket #1019353
Search in datatable
Closed

Comments

  •  2
    Azhar started the conversation

    I am not able to search, sort or paginate using angular code to display the data in datatable

    Following is my code and also attached screenshot

    <table class="table table-striped table-bordered" id="example-3">
        <thead>
        <tr class="replace-inputs">              
            <th>First Name</th>
            <th>Last Name</th>             
        </tr>
        </thead>
        <tbody>
         <tr ng-repeat="user in allUsers">             
            <td>{{user.firstName}}</td>
            <td>{{user.lastName}}</td>

        </tr>

       </tbody>
    </table>

  • [deleted] replied

    Hi Azhar,

    Please update DataTables library to latest version because they have improved their API for searching the table:

    // DataTable
    var table = $('#example').DataTable();

    // Apply the search
    table.columns().every( function () {
    var that = this;

    $( 'input', this.footer() ).on( 'keyup change', function () {
    if ( that.search() !== this.value ) {
    that
    .search( this.value )
    .draw();
    }
    } );
    } );

    This way it fill filter the results, you can refer to this article:

    https://datatables.net/examples/api/multi_filter.html

    Hopefully this will help you.