Ticket #760: dataTable.html

File dataTable.html, 1.2 KB (added by vipsoft, 9 months ago)

Sample code

Line 
1<html>
2<head>
3<title>HTML Table Example</title>
4<script src="jquery.js" type="text/javascript"></script>
5<script src="jquery.dataTables.js" type="text/javascript"></script>
6<script src="jquery.flot.js" type="text/javascript" ></script>
7<script src="jquery.graphTable-0.2.js" type="text/javascript"></script>
8<script type="text/javascript">
9$.ajax({
10        url: 'http://localhost/index.php?module=API&method=VisitsSummary.get&idSite=1&period=day&date=last10&format=Html&token_auth=anonymous',
11        success: function (results) {
12                $('#tableWrapper1').html(results);
13                $('#tableWrapper1 #VisitsSummary_get').graphTable(
14                        {
15                                series: 'columns',
16                                firstSeries: 5,
17                                lastSeries: 5,
18                                position: 'replace',
19                                xaxisTransform: function (s) {
20                                        return s.substring(8);
21                                }
22                        }
23                );
24
25                $('#tableWrapper2').html(results);
26                $('#tableWrapper2 VisitsSummary_get').dataTable({
27                        "bLengthChange": false,
28                        "bFilter": false,
29                        "aoData": [
30                                { "sTitle": "Date" },
31                                { "bVisible": false },
32                                { "bVisible": false },
33                                { "bVisible": false },
34                                { "bVisible": false },
35                                { "sTitle": "# Visits" },
36                                { "bVisible": false },
37                                { "bVisible": false },
38                        ]
39                });
40        }
41});
42</script>
43</head>
44<body>
45<div id="tableWrapper1"></div>
46<div id="tableWrapper2"></div>
47</body>
48</html>