Advertisement
Guest User

Untitled

a guest
Jan 21st, 2015
490
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * All pull related javascripts shall be here
  3.  */
  4. //global vars
  5.  
  6. // View all Pull
  7. $(document)
  8.         .ready(
  9.                 function() {
  10.                     $("#tablediv").hide();
  11.                     $("#showTable")
  12.                             .click(
  13.                                     function(event) {
  14.                                        
  15.                                         var styleSheet ="<link href=\"resources/bootstrap/css/bootstrap.min.css\" rel=\"stylesheet\">";
  16.                                         var viewIcon = "<div class=\"row\"><div class=\"col-md-4\"> <button type=\"button\" onClick=\"doAjaxView()\" class=\"btn btn-link\"><span class=\"glyphicon glyphicon-edit\" \"></span></button></div>";
  17.                                         var editIcon = "<div class=\"col-md-4\"><div class=\"col-md-4\"> <button type=\"button\" onClick=\"doAjaxView()\" class=\"btn btn-link\"><span class=\"glyphicon glyphicon-folder-open\" \"></span></button></div>";
  18.                                         var deleteIcon = "<div class=\"col-md-4\"><div class=\"col-md-4\"> <button type=\"button\" onClick=\"doAjaxView()\" class=\"btn btn-link\"><span class=\"glyphicon glyphicon-remove\" \"></span></button></div></div>";
  19.                                         $
  20.                                                 .get(
  21.                                                         'populate/pull',
  22.                                                         function(responseJson) {
  23.                                                             if (responseJson != null) {
  24.                                                                 pullTable =$("#pulltable")
  25.                                                                         .DataTable(
  26.                                                                                 {
  27.                                                                                     "bServerSide" : true,
  28.                                                                                     "sAjaxSource" : "populate/pull",
  29.                                                                                     "bProcessing" : true,
  30.                                                                                     "sPaginationType" : "full_numbers",
  31.                                                                                     "bJQueryUI" : true,
  32.                                                                                     "aoColumns" : [
  33.                                                                                             {
  34.                                                                                                 "mRender" : function() {
  35.                                                                                                     var actionIcons = styleSheet+viewIcon
  36.                                                                                                             + editIcon
  37.                                                                                                             + deleteIcon;
  38.                                                                                                     return actionIcons;
  39.                                                                                                 }
  40.                                                                                             },
  41.                                                                                             {
  42.                                                                                                 "mDataProp" : "id"
  43.                                                                                             },
  44.                                                                                             {
  45.                                                                                                 "mDataProp" : "alias1"
  46.                                                                                             },
  47.                                                                                             {
  48.                                                                                                 "mDataProp" : "alias2"
  49.                                                                                             },
  50.                                                                                             {
  51.                                                                                                 "mDataProp" : "alias3"
  52.                                                                                             },
  53.                                                                                             {
  54.                                                                                                 "mDataProp" : "alias4"
  55.                                                                                             },
  56.                                                                                             {
  57.                                                                                                 "mDataProp" : "keyword"
  58.                                                                                             },
  59.                                                                                             {
  60.                                                                                                 "mDataProp" : "charNo"
  61.                                                                                             },
  62.                                                                                             {
  63.                                                                                                 "mDataProp" : "korWord"
  64.                                                                                             },
  65.                                                                                             {
  66.                                                                                                 "mDataProp" : "korCharNo"
  67.                                                                                             },
  68.                                                                                             {
  69.                                                                                                 "mDataProp" : "charTotal"
  70.                                                                                             }, ]
  71.                                                                                 });
  72.                                                             }
  73.                                                         });
  74.                                         $("#tablediv").show();
  75.                                     });
  76.                 });
  77.  
  78. $('#myTab a').click(function(e) {
  79.     e.preventDefault();
  80.     $(this).tab('show');
  81. });
  82.  
  83. // Save Pull
  84. function doAjaxSave() {
  85.     var keyword = $('#keyword').val();
  86.     var alias1 = $('#alias1').val();
  87.     var alias2 = $('#alias2').val();
  88.     var alias3 = $('#alias3').val();
  89.     var alias4 = $('#alias4').val();
  90.     var korWord = $('#korWord').val();
  91.     $.ajax({
  92.         type : "Get",
  93.         url : "save/pull",
  94.         data : "keyword=" + keyword + "&alias1=" + alias1 + "&alias2=" + alias2
  95.                 + "&alias3=" + alias3 + "&alias4=" + alias4 + "&korWord="
  96.                 + korWord,
  97.         success : function(result) {
  98.             alert(result);
  99.  
  100.         },
  101.         error : function(e) {
  102.             alert('Error: ' + e);
  103.         }
  104.     });
  105. }
  106.  
  107. //view row data
  108. function doAjaxView() {
  109.     var table = $('#pulltable').DataTable();
  110.      alert( table.cell( this ).data() );
  111.      $('#keyword').val("test" );
  112.     $('#myModal').modal("show");
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement