Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * All pull related javascripts shall be here
- */
- //global vars
- // View all Pull
- $(document)
- .ready(
- function() {
- $("#tablediv").hide();
- $("#showTable")
- .click(
- function(event) {
- var styleSheet ="<link href=\"resources/bootstrap/css/bootstrap.min.css\" rel=\"stylesheet\">";
- 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>";
- 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>";
- 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>";
- $
- .get(
- 'populate/pull',
- function(responseJson) {
- if (responseJson != null) {
- pullTable =$("#pulltable")
- .DataTable(
- {
- "bServerSide" : true,
- "sAjaxSource" : "populate/pull",
- "bProcessing" : true,
- "sPaginationType" : "full_numbers",
- "bJQueryUI" : true,
- "aoColumns" : [
- {
- "mRender" : function() {
- var actionIcons = styleSheet+viewIcon
- + editIcon
- + deleteIcon;
- return actionIcons;
- }
- },
- {
- "mDataProp" : "id"
- },
- {
- "mDataProp" : "alias1"
- },
- {
- "mDataProp" : "alias2"
- },
- {
- "mDataProp" : "alias3"
- },
- {
- "mDataProp" : "alias4"
- },
- {
- "mDataProp" : "keyword"
- },
- {
- "mDataProp" : "charNo"
- },
- {
- "mDataProp" : "korWord"
- },
- {
- "mDataProp" : "korCharNo"
- },
- {
- "mDataProp" : "charTotal"
- }, ]
- });
- }
- });
- $("#tablediv").show();
- });
- });
- $('#myTab a').click(function(e) {
- e.preventDefault();
- $(this).tab('show');
- });
- // Save Pull
- function doAjaxSave() {
- var keyword = $('#keyword').val();
- var alias1 = $('#alias1').val();
- var alias2 = $('#alias2').val();
- var alias3 = $('#alias3').val();
- var alias4 = $('#alias4').val();
- var korWord = $('#korWord').val();
- $.ajax({
- type : "Get",
- url : "save/pull",
- data : "keyword=" + keyword + "&alias1=" + alias1 + "&alias2=" + alias2
- + "&alias3=" + alias3 + "&alias4=" + alias4 + "&korWord="
- + korWord,
- success : function(result) {
- alert(result);
- },
- error : function(e) {
- alert('Error: ' + e);
- }
- });
- }
- //view row data
- function doAjaxView() {
- var table = $('#pulltable').DataTable();
- alert( table.cell( this ).data() );
- $('#keyword').val("test" );
- $('#myModal').modal("show");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement