View | Details | Raw Unified | Return to bug 29949
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-27 lines)
Lines 314-346 jQuery.extend( jQuery.fn.dataTableExt.oSort, { Link Here
314
    }
314
    }
315
} );
315
} );
316
316
317
/* Plugin to allow sorting on numeric data stored in a span's title attribute
318
 *
319
 * Ex: <td><span title="[% decimal_number_that_JS_parseFloat_accepts %]">
320
 *              [% formatted currency %]
321
 *     </span></td>
322
 *
323
 * In DataTables config:
324
 *     "aoColumns": [
325
 *        { "sType": "title-numeric" },
326
 *      ]
327
 * http://datatables.net/plug-ins/sorting#hidden_title
328
 */
329
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
330
    "title-numeric-pre": function ( a ) {
331
        var x = a.match(/title="*(-?[0-9\.]+)/)[1];
332
        return parseFloat( x );
333
    },
334
335
    "title-numeric-asc": function ( a, b ) {
336
        return ((a < b) ? -1 : ((a > b) ? 1 : 0));
337
    },
338
339
    "title-numeric-desc": function ( a, b ) {
340
        return ((a < b) ? 1 : ((a > b) ? -1 : 0));
341
    }
342
} );
343
344
(function() {
317
(function() {
345
318
346
    /* Plugin to allow text sorting to ignore articles
319
    /* Plugin to allow text sorting to ignore articles
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-topissues.tt (-5 / +4 lines)
Lines 88-94 Link Here
88
                                    <tr>
88
                                    <tr>
89
                                        <th class="anti-the">Title</th>
89
                                        <th class="anti-the">Title</th>
90
                                        <th>[% IF ( ccodesearch ) %]Collection[% ELSE %]Item type[% END %]</th>
90
                                        <th>[% IF ( ccodesearch ) %]Collection[% ELSE %]Item type[% END %]</th>
91
                                        <th class="title-num">Checkouts</th>
91
                                        <th>Checkouts</th>
92
                                        [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
92
                                        [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
93
                                            <th class="NoSort">&nbsp;</th>
93
                                            <th class="NoSort">&nbsp;</th>
94
                                        [% END %]
94
                                        [% END %]
Lines 118-126 Link Here
118
                                                    [% ItemTypes.GetDescription(result.itemtype) | html %]
118
                                                    [% ItemTypes.GetDescription(result.itemtype) | html %]
119
                                                [% END %]
119
                                                [% END %]
120
                                            </td>
120
                                            </td>
121
                                            <td>
121
                                            <td data-order="[% result.count | html %]">
122
                                                <span class="tdlabel">Checkouts: </span>
122
                                                <span class="tdlabel">Checkouts: </span>
123
                                                <span title="[% result.count | html %]">[% result.count | html %]</span>
123
                                                [% result.count | html %]
124
                                            </td>
124
                                            </td>
125
                                            [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
125
                                            [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
126
                                                <td>
126
                                                <td>
Lines 153-160 Link Here
153
                "sorting": [[2, "desc"]],
153
                "sorting": [[2, "desc"]],
154
                "columnDefs": [
154
                "columnDefs": [
155
                    { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
155
                    { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
156
                    { "type": "anti-the", "targets" : [ "anti-the" ] },
156
                    { "type": "anti-the", "targets" : [ "anti-the" ] }
157
                    { "type": "title-numeric", "targets" : [ "title-num"] },
158
                ]
157
                ]
159
            }));
158
            }));
160
        });
159
        });
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js (-28 lines)
Lines 70-102 $.fn.dataTable.ext.buttons.clearFilter = { Link Here
70
    }
70
    }
71
};
71
};
72
72
73
/* Plugin to allow sorting on numeric data stored in a span's title attribute
74
 *
75
 * Ex: <td><span title="[% decimal_number_that_JS_parseFloat_accepts %]">
76
 *              [% formatted currency %]
77
 *     </span></td>
78
 *
79
 * In DataTables config:
80
 *     "aoColumns": [
81
 *        { "sType": "title-numeric" },
82
 *      ]
83
 * http://datatables.net/plug-ins/sorting#hidden_title
84
 */
85
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
86
    "title-numeric-pre": function ( a ) {
87
        var x = a.match(/title="*(-?[0-9\.]+)/)[1];
88
        return parseFloat( x );
89
    },
90
91
    "title-numeric-asc": function ( a, b ) {
92
        return ((a < b) ? -1 : ((a > b) ? 1 : 0));
93
    },
94
95
    "title-numeric-desc": function ( a, b ) {
96
        return ((a < b) ? 1 : ((a > b) ? -1 : 0));
97
    }
98
} );
99
100
(function() {
73
(function() {
101
74
102
    /* Plugin to allow text sorting to ignore articles
75
    /* Plugin to allow text sorting to ignore articles
103
- 

Return to bug 29949