jquery - Datatable searching is not working -
i using datatable in project robust searching , many more advantages of datatable when need value of search box searching of datatable not working. need searching value of search box deleting data when apply code of getting value of search box searching not working in datable.
below code.
<html> <title>example 1 - apply datatable()</title> <link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.datatables/1.9.0/css/jquery.datatables.css"> <link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.datatables/1.9.0/css/jquery.datatables_themeroller.css"> <script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.7.1.min.js"></script> <script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.datatables/1.9.0/jquery.datatables.min.js"></script> </head> <body> <div class="container"> <table cellpadding="0" cellspacing="0" border="0" class="datatable" id="example"> <thead> <tr> <th>id</th> <th>name</th> </tr> </thead> <tbody> <tr> <td>21</td> <td>varun</td> </tr> <tr> <td>22</td> <td>nitin</td> </tr> </tbody> </table> </div> </body> </html>
script code:
<script> $('#example').datatable({"spaginationtype": "full_numbers"}); var table = $('#example').datatable(); //getting value of search box $('.datatables_filter input').unbind().keyup(function(e) { var value = $(this).val(); if (value.length>3) { alert(value); table.search(value).draw(); } else { //optional, reset search if phrase //is less 3 characters long table.search('').draw(); } }); </script>
please me, in advance
here woring code
<html> <title>example 1 - apply datatable()</title> <link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.datatables/1.9.0/css/jquery.datatables.css"> <link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.datatables/1.9.0/css/jquery.datatables_themeroller.css"> <script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.7.1.min.js"></script> <script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.datatables/1.9.0/jquery.datatables.min.js"></script> </head> <body> <div class="container"> <table cellpadding="0" cellspacing="0" border="0" class="datatable" id="example"> <thead> <tr> <th>id</th> <th>name</th> </tr> </thead> <tbody> <tr> <td>21</td> <td>varun</td> </tr> <tr> <td>22</td> <td>nitin</td> </tr> </tbody> </table> </div> <script type="text/javascript"> $(document).ready(function() { $('#example').datatable({"spaginationtype": "full_numbers"}); $('#example').datatable(); } ); </script> </body> </html>
Comments
Post a Comment