}
} );
+
+/* Plugin to allow sorting on numeric data stored in a span's title attribute
+ *
+ * Ex: <td><span title="[% decimal_number_that_JS_parseFloat_accepts %]">
+ * [% formatted currency %]
+ * </span></td>
+ *
+ * In DataTables config:
+ * "aoColumns": [
+ * { "sType": "title-numeric" },
+ * ]
+ * http://datatables.net/plug-ins/sorting#hidden_title
+ */
+jQuery.extend( jQuery.fn.dataTableExt.oSort, {
+ "title-numeric-pre": function ( a ) {
+ var x = a.match(/title="*(-?[0-9\.]+)/)[1];
+ return parseFloat( x );
+ },
+
+ "title-numeric-asc": function ( a, b ) {
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
+ },
+
+ "title-numeric-desc": function ( a, b ) {
+ return ((a < b) ? 1 : ((a > b) ? -1 : 0));
+ }
+} );
+
(function() {
/* Plugin to allow text sorting to ignore articles
}
});
-}());
\ No newline at end of file
+}());
null,
null,
null,
- null,
- { "sType": "num-html" },
- { "sType": "num-html" },
- null
+ { "sType": "title-numeric" },
+ { "sType": "title-numeric" },
+ { "sType": "title-numeric" },
+ { "sType": "title-numeric" }
],
'sDom': 't',
'bPaginate': false,
[% END %]
</td>
<td>[% loop_budge.budget_branchname %]</td>
- <td class="data">[% loop_budge.budget_amount %]</td>
- <td class="data"><a href="ordered.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.budget_ordered %]</a></td>
- <td class="data"><a href="spent.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.budget_spent %]</a></td>
- <td class="data">[% loop_budge.budget_avail %]</td>
+ <td class="data"><span title="[% loop_budge.budget_amount %]">[% loop_budge.formatted_budget_amount %]</span></td>
+ <td class="data"><span title="[% loop_budge.budget_ordered %]"><a href="ordered.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.formatted_budget_ordered %]</a></span></td>
+ <td class="data"><span title="[% loop_budge.budget_spent %]"><a href="spent.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.formatted_budget_spent %]</span></a></td>
+ <td class="data"><span title="[% loop_budge.budget_avail %]">[% loop_budge.formatted_budget_avail %]</td>
</tr>
[% ELSE %]
<tr class="b_inactive">
[% END %]
</td>
<td>[% loop_budge.budget_branchname %]</td>
- <td class="data">[% loop_budge.budget_amount %]</td>
- <td class="data"><a href="ordered.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.budget_ordered %]</a></td>
- <td class="data"><a href="spent.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.budget_spent %]</a></td>
- <td class="data">[% loop_budge.budget_avail %]</td>
+ <td class="data"><span title="[% loop_budge.budget_amount %]">[% loop_budge.formatted_budget_amount %]</span></td>
+ <td class="data"><span title="[% loop_budge.budget_ordered %]"><a href="ordered.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.formatted_budget_ordered %]</a></span></td>
+ <td class="data"><span title="[% loop_budge.budget_spent %]"><a href="spent.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.formatted_budget_spent %]</span></a></td>
+ <td class="data"><span title="[% loop_budge.budget_avail %]">[% loop_budge.formatted_budget_avail %]</td>
</tr>
[% END %]
[% END %]