File size: 981 Bytes
24c4def
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
$(document).ready(function () {
    table = $('.model-summary').DataTable({
        "stateSave": false,
        "lengthChange": false,
        "pageLength": 10,
        "order": [],
        "scrollX": true,
        "columnDefs": [
            { "type": "summary", targets: '_all' },
        ]
    });
    // Override the default sorting for the summary columns, which
    // never takes the "-" character into account.
    jQuery.extend(jQuery.fn.dataTableExt.oSort, {
        "summary-asc": function (str1, str2) {
            if (str1 == "<p>-</p>")
                return 1;
            if (str2 == "<p>-</p>")
                return -1;
            return ((str1 < str2) ? -1 : ((str1 > str2) ? 1 : 0));
        },

        "summary-desc": function (str1, str2) {
            if (str1 == "<p>-</p>")
                return 1;
            if (str2 == "<p>-</p>")
                return -1;
            return ((str1 < str2) ? 1 : ((str1 > str2) ? -1 : 0));
        }
    });
})