1
|
/**
|
2
|
* Java script to setup and anable the cdm webservice debug block.
|
3
|
* The cdm webservice debug block is implemented in the cdm_api submodule
|
4
|
*/
|
5
|
jQuery(document).ready(function($) {
|
6
|
|
7
|
$('#cdm-ws-debug-table').dataTable({
|
8
|
"bPaginate" : false,
|
9
|
"bFilter" : true,
|
10
|
"bSort" : true,
|
11
|
"bInfo" : true,
|
12
|
"bProcessing" : true,
|
13
|
"bStateSave " : true,
|
14
|
"bRegex" : true, // the search string will be treated as a regular expression
|
15
|
"aaSorting": [[ 1, "asc" ]], // initially sort by time
|
16
|
"fnFooterCallback": function( nFoot, aData, iStart, iEnd, aiDisplay ) {
|
17
|
|
18
|
var colums_to_sum_up = {0: "Total:", 2: "doSum", 3: "doSum", 4: "doSum"};
|
19
|
|
20
|
$(nFoot).find('th').each(function(colIndex){
|
21
|
var newHtml = '';
|
22
|
if(colums_to_sum_up[colIndex] == "doSum"){
|
23
|
sum = 0;
|
24
|
for(var rowIndex = iStart; rowIndex < iEnd; rowIndex++){
|
25
|
sum += Number(aData[rowIndex][colIndex]);
|
26
|
}
|
27
|
newHtml = sum.toFixed(3);
|
28
|
} else if(colums_to_sum_up[colIndex]) {
|
29
|
newHtml = colums_to_sum_up[colIndex];
|
30
|
}
|
31
|
$(this).html(newHtml);
|
32
|
});
|
33
|
},
|
34
|
"oLanguage": {
|
35
|
"sSearch": "Filter table rows (search string will be treated as a regular expression):"
|
36
|
}
|
37
|
});
|
38
|
|
39
|
$('#cdm-ws-debug-button').css('cursor', 'pointer').colorbox({
|
40
|
"href" : '#cdm-ws-debug-table_wrapper', // wrapper created by dataTable()
|
41
|
"inline" : true,
|
42
|
"width" : '90%',
|
43
|
"height" : '90%'
|
44
|
});
|
45
|
});
|