-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathchart_customsort.html
More file actions
43 lines (33 loc) · 1.28 KB
/
Copy pathchart_customsort.html
File metadata and controls
43 lines (33 loc) · 1.28 KB
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
<script>
jQuery.fn.dataTableExt.oSort['string_ignore_null-asc'] = function(x,y) {
if (x == null && y == null) return ((x < y) ? 1 : ((x > y) ? -1 : 0));
if (x == null) return 1;
if (y == null) return -1;
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
jQuery.fn.dataTableExt.oSort['string_ignore_null-desc'] = function(x,y) {
if (x == null && y == null) return ((x < y) ? 1 : ((x > y) ? -1 : 0));
if (x == null) return 1;
if (y == null) return -1;
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
</script>
<script type="text/javascript" charset="utf-8">
var chartParams{{{ chartId }}} = {{{ chartParams }}}
$('#' + chartParams{{{ chartId }}}.id).removeClass("rChart")
$(document).ready(function() {
drawDataTable(chartParams{{{ chartId }}})
});
function drawDataTable(chartParams){
var dTable = $('#' + chartParams.dom).dataTable(
chartParams.table
);
//first use rCharts width
$('#'+chartParams.id+"_wrapper").css("width",chartParams.width)
$('#'+chartParams.id+"_wrapper").css("width",chartParams.table.width)
//then if specified change to table width
$('#'+chartParams.id+"_wrapper").css("margin-left", "auto");
$('#'+chartParams.id+"_wrapper").css("margin-right", "auto");
dTable.fnAdjustColumnSizing();
}
</script>