Advertisement
PrestonDvorak

dialog.html - datatables tinymce

Jul 18th, 2017
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.84 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Add Spell Dialog</title>
  6.     <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  7.     <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.15/css/dataTables.bootstrap.min.css">
  8.     <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.bootstrap.min.css">
  9.     <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/select/1.2.2/css/select.bootstrap.min.css">
  10.     <link rel="stylesheet" type="text/css" href="css/editor.bootstrap.min.css">
  11.     <style type="text/css" class="init">
  12.         #example_wrapper{
  13.             margin:auto 20px;
  14.         }
  15.     </style>
  16.     <script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.12.4.js"></script>
  17.     <script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
  18.     <script type="text/javascript" language="javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  19.     <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
  20.     <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.15/js/dataTables.bootstrap.min.js"></script>
  21.     <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script>
  22.     <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.bootstrap.min.js"></script>
  23.     <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/select/1.2.2/js/dataTables.select.min.js"></script>
  24.     <script type="text/javascript" language="javascript" src="js/dataTables.editor.min.js"></script>
  25.     <script type="text/javascript" language="javascript" src="js/editor.bootstrap.min.js"></script>
  26.     <script type="text/javascript" language="javascript" class="init">
  27.         var editor;
  28.         $(document).ready(function(){
  29.             editor = new $.fn.dataTable.Editor({
  30.                 ajax: 'datatables-warcraft-db-spells.php',
  31.                 table: '#example',
  32.                 fields: [{
  33.                         label: 'ID:',
  34.                         name: 'id'
  35.                     },
  36.                     {
  37.                         label: 'Type:',
  38.                         name: 'type'
  39.                     },
  40.                     {
  41.                         label: 'Name:',
  42.                         name: 'name'
  43.                     },
  44.                     {
  45.                         label: 'Icon:',
  46.                         name: 'icon'
  47.                     }
  48.                 ]
  49.             });
  50.  
  51.             var table = $('#example').DataTable({
  52.                 lengthChange: false,
  53.                 ajax: 'datatables-warcraft-db-spells.php',
  54.                 columns: [
  55.                     { data: 'id', className: 'id' },
  56.                     { data: 'type', className: 'type'  },
  57.                     { data: 'name', className: 'name'  },
  58.                     { data: 'icon', className: 'icon'  }
  59.                 ],
  60.                 buttons: [
  61.                     { extend: 'create', editor: editor },
  62.                     { extend: 'edit',   editor: editor },
  63.                     { extend: 'remove', editor: editor },
  64.                     {
  65.                          extend: 'selectedSingle',
  66.                          text:   'Insert into Content' ,
  67.                          action: function ( e, dt, node, config ) {
  68.                              var idx = table.cell('.selected', 0).index();
  69.                              var data = table.row( idx.row ).data();
  70.                              console.log(data);
  71.                              console.log(data.name);
  72.                              //window.opener.tinymce.activeEditor.selection.setContent('Testing');
  73.                             tinyMCE.activeEditor.setContent('Testing');
  74.                             //tinymce.activeEditor.selection.setContent('Testing');
  75.                          }
  76.                      }
  77.                 ],
  78.                 select: true,
  79.                 initComplete : function () {
  80.                     table.buttons().container()
  81.                         .appendTo( $('.col-sm-6:eq(0)', table.table().container() ) );
  82.                 }
  83.             });
  84.         });
  85.     </script>
  86. </head>
  87.  
  88. <body>
  89.  
  90. <table id="example" class="table table-striped table-bordered" cellspacing="0" width="100%">
  91. <thead>
  92.     <tr>
  93.         <th>ID</th>
  94.         <th>Type</th>
  95.         <th>Name</th>
  96.         <th>Icon</th>
  97.     </tr>
  98. </thead>
  99. <tfoot>
  100.     <tr>
  101.         <th>ID</th>
  102.         <th>Type</th>
  103.         <th>Name</th>
  104.         <th>Icon</th>
  105.     </tr>
  106. </tfoot>
  107. </table>
  108. </body>
  109. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement