Advertisement
Guest User

datatable script

a guest
May 20th, 2011
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.36 KB | None | 0 0
  1. if (typeof aTable=='undefined'){
  2.        aTable = $("#unfinish").dataTable({
  3.                      "bRetrieve"  : true,
  4.                      "bServerSide": true,
  5.                      "bProcessing": true,
  6.                      "sAjaxSource": 'show_unfinish.php',
  7.                      "bAutoWidth" : true,
  8.                      "fnServerData": function (sSource,aoData,fnCallback){
  9.                         aoData.push({"name":"date","value":$("#datepicker").val()});
  10.                             aoData.push({"name":"line","value":$("#line").val()});
  11.                             aoData.push({"name":"model","value":$("#model").val()});
  12.                             aoData.push({"name":"lotno","value":$("#lotno").val()});
  13.                             aoData.push({"name":"range","value":$("#range").val()});
  14.                             aoData.push({"name":"error","value":$("#error").val()});
  15.                             aoData.push({"name":"pic","value":$("#pic").val()});
  16.  
  17.                             $.ajax({
  18.                                      "dataType":'json',
  19.                                      "type":'POST',
  20.                                      "url":sSource,
  21.                                      "data":aoData,
  22.                                      "success":function(json){
  23.                                                                fnCallback(json);
  24.                                                                }
  25.                       });
  26.                             },
  27.                  "aaSorting"  : [[1,"desc"]],
  28.                  "aoColumns"  : [
  29.                                  /*Date*/  null,
  30.                                  /*Line*/ null,
  31.                                  /*Model*/null,
  32.                                  /*Lotno*/null,
  33.                                  /*Range*/null,
  34.                                  /*Error*/null,
  35.                                  /*PIC*/null
  36.                                  ]
  37.                    });
  38.                         }else{
  39.                                 aTable.fnDraw();
  40.                          }
  41.  
  42.  
  43. //for another table setup
  44.  $("tfoot input").keyup( function () {
  45.                                 /* Filter on the column (the index) of this element */
  46.                                 oTable.fnFilter( this.value, $("tfoot input").index(this) );
  47.                                 });
  48.  
  49.                 /*
  50.                  * Support functions to provide a little bit of 'user friendlyness' to the textboxes in
  51.                  * the footer
  52.                  */
  53.                 $("tfoot input").each( function (i) {
  54.                                 asInitVals[i] = this.value;
  55.                                 });
  56.  
  57.                 $("tfoot input").focus( function () {
  58.                                 if ( this.className == "search_init" )
  59.                                 {
  60.                                         this.className = "";
  61.                                         this.value = "";
  62.                                 }
  63.                         });
  64.  
  65.                 $("tfoot input").blur( function (i) {
  66.                                 if ( this.value == "" )
  67.                                 {
  68.                                         this.className = "search_init";
  69.                                         this.value = asInitVals[$("tfoot input").index(this)];
  70.                                 }
  71.                         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement