search not working in server side processing

search not working in server side processing

jemzjemz Posts: 131Questions: 40Answers: 1
edited September 2014 in Free community support

I followed this http://www.datatables.net/examples/data_sources/server_side.html
when I run the program and try to search in searchbox it did not filter my data.it will go back to page 1

what is wrong ?

Answers

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

    No-one can debug your code without seeing it.

  • jemzjemz Posts: 131Questions: 40Answers: 1
    edited September 2014

    @tangerine Here is my code

       ```javascript
      var empno = '000005';
      $(document).ready(function() {
    
    
      $('#example').dataTable( {
          "processing": true,
            "serverSide": true,
           "start": 0,
             "ajax": {
                url:"querydata.php?devid="+empno
    
           },
           "columns": [
                  { "data": "id" },
                   { "data": "firstname" },
                   { "data": "lastname" },
                   { "data": "age" }
    
              ]
    
             } );
    
    
        } );
    



    ```HTML <div class="container"> <table id="example" class="display" cellspacing="0" width="100%"> <thead> <tr> <th>ID</th> <th>FIRSTNAME</th> <th>LASTNAME</th> <th>AGE</th> </tr> </thead> </table> </div>
  • jemzjemz Posts: 131Questions: 40Answers: 1

    @tangerine, here is my code


    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="css/dataTables.bootstrap.css"> <script src="js/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.dataTables.min.js"></script> <script type="text/javascript" src="js/dataTablesBootstrap.js"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#example').dataTable( { "processing": true, "serverSide": true, "start": 0, "ajax": { url:"querydata2.php" }, "columns": [ { "data": "id"}, { "data": "empno"}, { "data": "firstname"}, { "data": "lastname"} ] } ); } ); </script> </head> <body> <div class="container"> <table id="example" class="display" cellspacing="0" width="100%"> <thead> <tr> <th>ID</th> <th>EMPNO</th> <th>FIRSTNAME</th> <th>LASTNAME</th> </tr> </thead> </table> </div> </body> </html>
  • jemzjemz Posts: 131Questions: 40Answers: 1

    this is the data response...

    {"draw":1,"recordsTotal":406504,"recordsFiltered":406504,"data":[{"id":"10","empno":"000006","firstname":"michelle","lastname":"ang"},{"id":"11","empno":"000007","firsname":"jean","lastname":"shane"},{"id":"12","empno":"000008","firstname":"annie","lastname":"merely"},{"id":"15","empno":"000009","lastname":"jack","lastname":"mack"},{"id":"16","empno":"0000010","firstname":"jill","lastname":"hill"},{"id":"17","empno":"000011","firstname":"matt","lastname":"monroe"},{"id":"18","empno":"000012","firstname":"alex","lastname":"heart"},{"id":"20","empno":"0000013","lastname":"carl","lastname":"jame"},{"id":"21","empno":"0000014","lastname":"kriz","lastname":"foonte"},{"id":"22","empno":"0000015","lastname":"micka","lastname":"andexter"}]}
    

    I hope someone can help me

    Thank you in advance

This discussion has been closed.