aboutsummaryrefslogtreecommitdiffstats
path: root/dbdocs/routines.js
blob: cdc2350a6f38fc766f5dcc04a2a2609a5dd2b6b3 (plain) (blame)
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
66
67
68
69
70
var filterBy = function(functionType) {
    $.fn.dataTableExt.afnFiltering.length = 0;
    $.fn.dataTable.ext.search.push(
        function( settings, data, dataIndex ) {
            var type = data[1]; // use data for the Type column

            if ( type.toUpperCase() == functionType || functionType == 'All' )
            {
                return true;
            }
            return false;
        }
    );
}

$(document).ready(function() {
	var activeObject;
    var table = $('#routine_table').DataTable( {
        lengthChange: false,
		ordering: true,
		paging: config.pagination,
		pageLength: 50,
		autoWidth: true,
		processing: true,
		order: [[ 0, "asc" ]],
        buttons: [
            {
                text: 'All',
                action: function ( e, dt, node, config ) {
                    filterBy('All');
                    if (activeObject != null) {
                        activeObject.active(false);
                    }
                    table.draw();
                }
            },
            {
                text: 'Functions',
                action: function ( e, dt, node, config ) {
                    filterBy('FUNCTION');
                    if (activeObject != null) {
                        activeObject.active(false);
                    }
                    this.active( !this.active() );
                    activeObject = this;
                    table.draw();
                }
            },
            {
                text: 'Procedures',
                action: function ( e, dt, node, config ) {
                    filterBy('PROCEDURE');
                    if (activeObject != null) {
                        activeObject.active(false);
                    }
                    this.active( !this.active() );
                    activeObject = this;
                    table.draw();
                }
            },
            {
                extend: 'columnsToggle',
                columns: '.toggle'
            }
        ]
    } );

    //schemaSpy.js
    dataTableExportButtons(table);
} );