Advertisement
Guest User

Untitled

a guest
Jul 7th, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. <script type="text/javascript">
  2. $(document).ready(function() {
  3. $("#detailReport").DataTable({
  4. "sDom": 'W<"clear">lfrtip',
  5. "bJQueryUI" : true,
  6. "bRetrieve" : true,
  7. "bFilter" : true, //Search Option
  8. "bLengthChange" : true, //Show count per page
  9. "bInfo" : true, //Total no of entries
  10. "bPaginate" : true, //Next Previous button
  11. initComplete: function () {
  12. this.api().columns('.select-filter').every( function () {
  13. var column = this;
  14. var select = $('<select id="defectSelectSearch"><option value="">All</option></select>')
  15. .appendTo( $("#typeFilter"))
  16. .on( 'change', function () {
  17. var val = $.fn.dataTable.util.escapeRegex(
  18. $(this).val()
  19. );
  20.  
  21. column
  22. .search( val ? '^'+val+'$' : '', true, false )
  23. .draw();
  24. } );
  25.  
  26. column.data().unique().sort().each( function ( d, j ) {
  27. if(d == '${selectedType}')
  28. select.append( '<option value="'+d+'" selected="selected">'+d+'</option>' );
  29. else
  30. select.append( '<option value="'+d+'">'+d+'</option>' );
  31. } );
  32. } );
  33. }
  34.  
  35. });
  36. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement