-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathdefault.js
65 lines (63 loc) · 1.77 KB
/
default.js
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
function setup_column_toggle() {
// get column headings, add to filter button
$.each($("#objectstores thead tr th"), function(i, elem) {
$("#filter-dropdown ul").append(
$('<li>', {class: "active"}).append(
$('<a>', {href: "javascript:;"})
.text($(elem).text())
.click(function(e) {
toggle_column(i);
$(this).parent().toggleClass("active");
$(this).blur(); // prevent focus style from sticking in Firefox
e.stopPropagation(); // keep dropdown menu open
})
)
);
});
}
function toggle_column(col_index) {
var table = $('#objectstores').dataTable();
var is_visible = table.fnSettings().aoColumns[col_index].bVisible;
table.fnSetColumnVis(col_index, is_visible ? false : true);
}
$(document).ready(function() {
setup_column_toggle();
$('#objectstores').dataTable( {
"aoColumns": [
null,
null,
null,
null,
null,
null,
null,
{ "asSorting": [ "desc", "asc" ] },
{ "asSorting": [ "desc", "asc" ] },
{ "asSorting": [ "desc", "asc" ] },
null,
null,
null,
],
"bPaginate": false,
"bInfo": false,
"columnDefs": [
{
"targets": 12,
"orderable": false
},
{
"targets": [ 3, 4, 5, 6, 10, 11, 12 ],
"visible": false
}
],
"initComplete": function() {
var table = $('#objectstores').dataTable();
$.each($("#filter-dropdown ul li a"), function(col_index) {
var is_visible = table.fnSettings().aoColumns[col_index].bVisible;
if (!is_visible) {
$(this).parent().toggleClass("active");
}
});
}
} );
} );