Subversion-Projekte lars-tiefland.cienc

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
9 lars 1
var TableDatatablesColreorder = function () {
2
 
3
    var initTable1 = function () {
4
        var table = $('#sample_1');
5
 
6
        var oTable = table.dataTable({
7
 
8
            // Internationalisation. For more info refer to http://datatables.net/manual/i18n
9
            "language": {
10
                "aria": {
11
                    "sortAscending": ": activate to sort column ascending",
12
                    "sortDescending": ": activate to sort column descending"
13
                },
14
                "emptyTable": "No data available in table",
15
                "info": "Showing _START_ to _END_ of _TOTAL_ entries",
16
                "infoEmpty": "No entries found",
17
                "infoFiltered": "(filtered1 from _MAX_ total entries)",
18
                "lengthMenu": "_MENU_ entries",
19
                "search": "Search:",
20
                "zeroRecords": "No matching records found"
21
            },
22
 
23
            // Or you can use remote translation file
24
            //"language": {
25
            //   url: '//cdn.datatables.net/plug-ins/3cfcc339e89/i18n/Portuguese.json'
26
            //},
27
 
28
            // setup buttons extentension: http://datatables.net/extensions/buttons/
29
            buttons: [
30
                { extend: 'print', className: 'btn dark btn-outline' },
31
                { extend: 'pdf', className: 'btn green btn-outline' },
32
                { extend: 'csv', className: 'btn purple btn-outline ' }
33
            ],
34
 
35
            // setup responsive extension: http://datatables.net/extensions/responsive/
36
            responsive: true,
37
 
38
            // setup colreorder extension: http://datatables.net/extensions/colreorder/
39
            colReorder: {
40
                reorderCallback: function () {
41
                    console.log( 'callback' );
42
                }
43
            },
44
 
45
            "order": [
46
                [0, 'asc']
47
            ],
48
 
49
            "lengthMenu": [
50
                [5, 10, 15, 20, -1],
51
                [5, 10, 15, 20, "All"] // change per page values here
52
            ],
53
            // set the initial value
54
            "pageLength": 10,
55
 
56
            "dom": "<'row' <'col-md-12'B>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r><'table-scrollable't><'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>", // horizobtal scrollable datatable
57
 
58
            // Uncomment below line("dom" parameter) to fix the dropdown overflow issue in the datatable cells. The default datatable layout
59
            // setup uses scrollable div(table-scrollable) with overflow:auto to enable vertical scroll(see: assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js).
60
            // So when dropdowns used the scrollable div should be removed.
61
            //"dom": "<'row' <'col-md-12'T>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r>t<'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>",
62
        });
63
    }
64
 
65
    var initTable2 = function () {
66
        var table = $('#sample_2');
67
 
68
        var oTable = table.dataTable({
69
 
70
            // Internationalisation. For more info refer to http://datatables.net/manual/i18n
71
            "language": {
72
                "aria": {
73
                    "sortAscending": ": activate to sort column ascending",
74
                    "sortDescending": ": activate to sort column descending"
75
                },
76
                "emptyTable": "No data available in table",
77
                "info": "Showing _START_ to _END_ of _TOTAL_ entries",
78
                "infoEmpty": "No entries found",
79
                "infoFiltered": "(filtered1 from _MAX_ total entries)",
80
                "lengthMenu": "_MENU_ entries",
81
                "search": "Search:",
82
                "zeroRecords": "No matching records found"
83
            },
84
 
85
            // Or you can use remote translation file
86
            //"language": {
87
            //   url: '//cdn.datatables.net/plug-ins/3cfcc339e89/i18n/Portuguese.json'
88
            //},
89
 
90
            buttons: [
91
                { extend: 'print', className: 'btn default' },
92
                { extend: 'pdf', className: 'btn default' },
93
                { extend: 'csv', className: 'btn default' }
94
            ],
95
 
96
            // setup colreorder extension: http://datatables.net/extensions/colreorder/
97
            colReorder: {
98
                reorderCallback: function () {
99
                    console.log( 'callback' );
100
                }
101
            },
102
 
103
            "order": [
104
                [0, 'asc']
105
            ],
106
 
107
            "lengthMenu": [
108
                [5, 10, 15, 20, -1],
109
                [5, 10, 15, 20, "All"] // change per page values here
110
            ],
111
            // set the initial value
112
            "pageLength": 10,
113
 
114
            "dom": "<'row' <'col-md-12'B>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r><'table-scrollable't><'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>", // horizobtal scrollable datatable
115
 
116
            // Uncomment below line("dom" parameter) to fix the dropdown overflow issue in the datatable cells. The default datatable layout
117
            // setup uses scrollable div(table-scrollable) with overflow:auto to enable vertical scroll(see: assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js).
118
            // So when dropdowns used the scrollable div should be removed.
119
            //"dom": "<'row' <'col-md-12'T>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r>t<'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>",
120
        });
121
    }
122
 
123
    return {
124
 
125
        //main function to initiate the module
126
        init: function () {
127
 
128
            if (!jQuery().dataTable) {
129
                return;
130
            }
131
 
132
            initTable1();
133
            initTable2();
134
        }
135
 
136
    };
137
 
138
}();
139
 
140
jQuery(document).ready(function() {
141
    TableDatatablesColreorder.init();
142
});