forked from Paradox2102/roborecon-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
90 lines (81 loc) · 2.96 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
layout: page
---
<div id="dashboard-container" class="container-fluid">
<div class="row">
<div id="buttons" class="col-md-12 text-right" style="margin-bottom:10px;"></div>
<div class="col-md-12">
<table id="dashboard" class="table table-striped table-bordered nowrap" cellspacing="0" width="100%">
</table>
</div>
</div>
</div>
<script>
$(function() {
// *** onload ***
// build dashboard
var dashboard = $('#dashboard').DataTable({
initComplete: function(settings, json) {
// add print, excel, column visibility buttons
$("#dashboard").DataTable().buttons().container().appendTo( $('#buttons'));
// required due to incompatiblity with fixedcolumns and scroller extensions
setTimeout(function() {$("#dashboard").DataTable().columns.adjust().draw(); }, 10);
},
ajax: function(data, callback, settings) {
// load the data -- for testing use: $.getJSON("{{ site.baseurl }}/test-data/sample-event-scores.json", function(teamData) {
$('.loaderImage').show();
ParadoxScout.getEventScoutingData(null, function(teamData, error) {
$('.loaderImage').hide();
if(error) {
AppUtility.showErrorMsg("An error occurred!", error);
}
else {
callback({
data: teamData,
destroy: true,
initComplete: function(settings, json) {
setTimeout(function() {$("#dashboard").DataTable().columns.adjust().draw(); }, 500);
}
});
}
});
},
// responsive: true,
// pageLength: 25,
paging: false,
scrollY:550,
scrollX:true,
scrollCollapse: true,
fixedColumns: true,
colReorder: {
fixedColumnsLeft: 1
},
order: app_dashboard_config.order,//[[ 1, "asc" ], [3, "desc"], [10, "desc"]], // default sort set to total_points | desc
buttons: [ { extend: 'colvis', title: 'Columns' },'print', { extend: 'excel', title: 'Excel' } ],
columns: [
{ title: 'Team', data: 'team_number',
render: function(data,type,full,meta) {
if (type === 'display') {
return '<span><a style="color:#ccc;font-weight:bold;" href="{{ site.baseurl }}/team-details?team_id=' + full.team_key + '">' + full.team_name + '</a></span><br>' +
'<span>' +
'<a style="color:#D59E2A;" href="{{ site.baseurl }}/scouting-reports?team_id=' + full.team_key + '"><i class="fa fa-files-o"> View Reports</i></a></span>'
}
else {
return data;
}
}
}
].concat(app_dashboard_config.cols),
'columnDefs': [{
'defaultContent': '-',
'targets': '_all'
}]
});
// make column header sticky
//new $.fn.dataTable.FixedHeader(dashboard, { headerOffset: $('#main-menu').height() });
// look for updated event scores every 30 sec.
setInterval( function () {
dashboard.ajax.reload( null, false ); // user paging is not reset on reload
}, 30000 );
});
</script>