Subversion-Projekte lars-tiefland.cienc

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
9 lars 1
var TableDatatablesRowreorder = 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 rowreorder extension: http://datatables.net/extensions/rowreorder/
36
            rowReorder: {
37
 
38
            },
39
 
40
            "order": [
41
                [0, 'asc']
42
            ],
43
 
44
            "lengthMenu": [
45
                [5, 10, 15, 20, -1],
46
                [5, 10, 15, 20, "All"] // change per page values here
47
            ],
48
            // set the initial value
49
            "pageLength": 10,
50
 
51
            "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
52
 
53
            // Uncomment below line("dom" parameter) to fix the dropdown overflow issue in the datatable cells. The default datatable layout
54
            // setup uses scrollable div(table-scrollable) with overflow:auto to enable vertical scroll(see: assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js).
55
            // So when dropdowns used the scrollable div should be removed.
56
            //"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>>",
57
        });
58
    }
59
 
60
    var initTable2 = function () {
61
        var table = $('#sample_2');
62
 
63
        var oTable = table.dataTable({
64
 
65
            // Internationalisation. For more info refer to http://datatables.net/manual/i18n
66
            "language": {
67
                "aria": {
68
                    "sortAscending": ": activate to sort column ascending",
69
                    "sortDescending": ": activate to sort column descending"
70
                },
71
                "emptyTable": "No data available in table",
72
                "info": "Showing _START_ to _END_ of _TOTAL_ entries",
73
                "infoEmpty": "No entries found",
74
                "infoFiltered": "(filtered1 from _MAX_ total entries)",
75
                "lengthMenu": "_MENU_ entries",
76
                "search": "Search:",
77
                "zeroRecords": "No matching records found"
78
            },
79
 
80
            // Or you can use remote translation file
81
            //"language": {
82
            //   url: '//cdn.datatables.net/plug-ins/3cfcc339e89/i18n/Portuguese.json'
83
            //},
84
 
85
            buttons: [
86
                { extend: 'print', className: 'btn default' },
87
                { extend: 'pdf', className: 'btn default' },
88
                { extend: 'csv', className: 'btn default' }
89
            ],
90
 
91
            // setup colreorder extension: http://datatables.net/extensions/colreorder/
92
            colReorder: {
93
                reorderCallback: function () {
94
                    console.log( 'callback' );
95
                }
96
            },
97
 
98
            // setup rowreorder extension: http://datatables.net/extensions/rowreorder/
99
            rowReorder: {
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
    TableDatatablesRowreorder.init();
142
});