comparison default/node_modules/tablesaw/demo/ajax-init-stack.html @ 0:1d038bc9b3d2 default tip

Up:default
author Liny <dev@neowd.com>
date Sat, 31 May 2025 09:21:51 +0800
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1d038bc9b3d2
1 <!doctype html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 <title>TableSaw Sortable Table</title>
8
9 <link rel="stylesheet" href="../dist/tablesaw.css">
10 <link rel="stylesheet" href="demo.css">
11 <link rel="stylesheet" href="//filamentgroup.github.io/demo-head/demohead.css">
12
13 <script src="../dist/tablesaw.js"></script>
14 <script src="../dist/tablesaw-init.js"></script>
15 <script src="//filamentgroup.github.io/demo-head/loadfont.js"></script>
16
17 <script>
18 $( document ).ready(function() {
19 var mydata = [
20 {"Name":"A", "P1":"1", "P2":"2", "P3":"3", "P4":"1", "P5":"2", "P6":"3"},
21 {"Name":"B", "P1":"4", "P2":"5", "P3":"6", "P4":"1", "P5":"2", "P6":"3"},
22 {"Name":"C", "P1":"7", "P2":"8", "P3":"9", "P4":"1", "P5":"2", "P6":"3"}
23 ];
24
25 $( '#ajaxed' ).html( "<table class='tablesaw tablesaw-stack' data-tablesaw-mode='stack' id='mytable'><thead><tr><th scope='col' data-tablesaw-priority='persist'>Name</th><th scope='col'>P1</th><th scope='col'>P2</th><th scope='col'>P3</th><th scope='col'>P4</th><th scope='col'>P5</th><th scope='col'>P6</th></tr></thead><tbody id='place1'></tbody></table>" );
26
27 var tbody = $( '#mytable tbody' ), props = ["Name","P1","P2","P3","P4","P5","P6"];
28
29 $.each( mydata, function(i, value){
30 var tr = $('<tr>');
31
32 $.each(props, function(i, prop){
33 $('<td>').html(value[prop]).appendTo(tr);
34 });
35
36 tbody.append(tr);
37 });
38
39 $('#mytable').tablesaw().data( "tablesaw" ).refresh();
40
41 });
42 </script>
43 </head>
44 <body>
45 <div class="demo-header">
46 <div class="company">
47 <img src="http://filamentgroup.com/images/fg-logo-positive-sm-crop.png">
48 </div>
49 <div class="details">
50 <h1 class="description-container">Demo of <span class="repo-name">Tablesaw</span>
51 <span class="description">A group of plugins for responsive tables.</span>
52 </h1>
53 <ul class="outbound-links">
54 <li><a href="https://github.com/filamentgroup/tablesaw">Code</a></li>
55 <li><a href="https://github.com/filamentgroup/tablesaw/issues">Issues</a></li>
56 </ul>
57 </div>
58 </div>
59 <div class="docs-main">
60 <h2>Swipe Table</h2>
61
62 <div id="ajaxed"></div>
63 </div>
64 </body>
65 </html>