@@ -, +, @@ --- .../intranet-tmpl/prog/en/modules/basket/basket.tt | 67 +++++++++++++------- 1 files changed, 44 insertions(+), 23 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt @@ -91,18 +91,51 @@ function placeHold () { $(".hold").text(_("Place Hold")); $("#downloadcartc").empty(); yuiToolbar(); + + /* Define two custom functions (asc and desc) for string sorting */ + jQuery.fn.dataTableExt.oSort['callnumbers-asc'] = function(x,y) { + var x_array = x.split(""); + var y_array = y.split(""); + + /* Pop the first elements, they are empty strings */ + x_array.shift(); + y_array.shift(); + + x_array.sort(); + y_array.sort(); + + x = x_array.shift(); + y = y_array.shift(); + + return ((x < y) ? -1 : ((x > y) ? 1 : 0)); + }; + + jQuery.fn.dataTableExt.oSort['callnumbers-desc'] = function(x,y) { + var x_array = x.split(""); + var y_array = y.split(""); + + /* Pop the first elements, they are empty strings */ + x_array.shift(); + y_array.shift(); + + x_array.sort(); + y_array.sort(); + + x = x_array.pop(); + y = y_array.pop(); + + return ((x < y) ? 1 : ((x > y) ? -1 : 0)); + }; + $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, { "sDom": 't', "aoColumnDefs": [ - { "aTargets": [ 0,3 ], "bSortable": false, "bSearchable": false }, + { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, + { "aTargets": [ 3 ], "sType": 'callnumbers' }, ], "aaSorting": [[ 1, "asc" ]], "bPaginate": false })); - $(".itemstable").dataTable($.extend(true, {}, dataTablesDefaults, { - "sDom": 't', - "bPaginate": false - })); }); @@ -383,26 +416,14 @@ function yuiToolbar() { [% BIBLIO_RESULT.description %] - [% IF ( BIBLIO_RESULT.ITEM_RESULTS ) %] - - - - - - + - - - + [% ITEM_RESULT.itemcallnumber %] [% ITEM_RESULT.branchname %] [% ITEM_RESULT.location_description %] [% END %] - -
LocationCall number
+ [% IF ( BIBLIO_RESULT.ITEM_RESULTS ) %] [% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %] -
[% ITEM_RESULT.branchname %] [% ITEM_RESULT.location_description %] - [% IF ( ITEM_RESULT.itemcallnumber ) %] - ([% ITEM_RESULT.itemcallnumber %]) - [% END %] -
- [% ELSE %]This record has no items.[% END %] + [% ELSE %] + This record has no items. + [% END %] [% END %] --