1 // These default options are for translation but can be used
2 // for any other datatables settings
3 // MSG_DT_* variables comes from datatables.inc
5 // $("#table_id").dataTable($.extend(true, {}, dataTableDefaults, {
8 var dataTablesDefaults = {
11 "sFirst" : window.MSG_DT_FIRST || "First",
12 "sLast" : window.MSG_DT_LAST || "Last",
13 "sNext" : window.MSG_DT_NEXT || "Next",
14 "sPrevious" : window.MSG_DT_PREVIOUS || "Previous"
16 "sEmptyTable" : window.MSG_DT_EMPTY_TABLE || "No data available in table",
17 "sInfo" : window.MSG_DT_INFO || "Showing _START_ to _END_ of _TOTAL_ entries",
18 "sInfoEmpty" : window.MSG_DT_INFO_EMPTY || "No entries to show",
19 "sInfoFiltered" : window.MSG_DT_INFO_FILTERED || "(filtered from _MAX_ total entries)",
20 "sLengthMenu" : window.MSG_DT_LENGTH_MENU || "Show _MENU_ entries",
21 "sLoadingRecords" : window.MSG_DT_LOADING_RECORDS || "Loading...",
22 "sProcessing" : window.MSG_DT_PROCESSING || "Processing...",
23 "sSearch" : window.MSG_DT_SEARCH || "Search:",
24 "sZeroRecords" : window.MSG_DT_ZERO_RECORDS || "No matching records found"
26 // "aaSorting": [$(" - select row position of th -")],
29 // "fnHeaderCallback": function() {
30 // return $('th.sorting.nosort,th.sorting_desc.nosort,th.sorting_asc.nosort').removeClass("sorting sorting_desc sorting_asc").unbind("click");
34 /* Plugin to allow sorting on data stored in a span's title attribute
36 * Ex: <td><span title="[% ISO_date %]">[% formatted_date %]</span></td>
38 * In DataTables config:
40 * { "sType": "title-string" },
42 * http://datatables.net/plug-ins/sorting#hidden_title_string
44 jQuery.extend( jQuery.fn.dataTableExt.oSort, {
45 "title-string-pre": function ( a ) {
46 return a.match(/title="(.*?)"/)[1].toLowerCase();
49 "title-string-asc": function ( a, b ) {
50 return ((a < b) ? -1 : ((a > b) ? 1 : 0));
53 "title-string-desc": function ( a, b ) {
54 return ((a < b) ? 1 : ((a > b) ? -1 : 0));
58 /* Plugin to allow sorting numerically on data stored in a span's title attribute
60 * Ex: <td><span title="[% total %]">Total: [% total %]</span></td>
62 * In DataTables config:
64 * { "sType": "title-numeric" }
66 * http://legacy.datatables.net/plug-ins/sorting#hidden_title
68 jQuery.extend( jQuery.fn.dataTableExt.oSort, {
69 "title-numeric-pre": function ( a ) {
71 var x = a.match(/title="*(-?[0-9\.]+)/)[1];
72 return parseFloat( x );
75 "title-numeric-asc": function ( a, b ) {
76 return ((a < b) ? -1 : ((a > b) ? 1 : 0));
79 "title-numeric-desc": function ( a, b ) {
80 return ((a < b) ? 1 : ((a > b) ? -1 : 0));
86 /* Plugin to allow text sorting to ignore articles
88 * In DataTables config:
90 * { "sType": "anti-the" },
92 * Based on the plugin found here:
93 * http://datatables.net/plug-ins/sorting#anti_the
94 * Modified to exclude HTML tags from sorting
95 * Extended to accept a string of space-separated articles
96 * from a configuration file (in English, "a," "an," and "the")
99 if(CONFIG_EXCLUDE_ARTICLES_FROM_SORT){
100 var articles = CONFIG_EXCLUDE_ARTICLES_FROM_SORT.split(" ");
102 for(i=0;i<articles.length;i++){
103 rpattern += "^" + articles[i] + " ";
104 if(i < articles.length - 1){ rpattern += "|"; }
106 var re = new RegExp(rpattern, "i");
109 jQuery.extend( jQuery.fn.dataTableExt.oSort, {
110 "anti-the-pre": function ( a ) {
111 var x = String(a).replace( /<[\s\S]*?>/g, "" );
113 var z = y.replace(re, "").toLowerCase();
117 "anti-the-asc": function ( a, b ) {
118 return ((a < b) ? -1 : ((a > b) ? 1 : 0));
121 "anti-the-desc": function ( a, b ) {
122 return ((a < b) ? 1 : ((a > b) ? -1 : 0));