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