Koha How-To

Move Overdues to Top of Checkout Table

Today’s guest post is from George Williams at VALNet:


I just posted some jQuery to the Koha wiki that moves overdue items to the top of the table when you’re checking things out to patrons and thought other ByWater partners would like to see it:

[code language=”javascript” wraplines=”true” toolbar=”true”]
//BEGIN Move overdues to the top of the table

$(‘#issues-table’).on( ‘init.dt’, function () {

$("#issues-table:has(.overdue)").attr(‘od’,’overduetable’);

if($("#issues-table").attr(‘od’)) {

$("#issues-table tbody").attr("class","checkoutbody");

$(‘.checkoutbody tr:first’).before(‘<tr id="overduetr"><td colspan="10" style="background-color:pink; font-size: x-large"><strong>Patron has overdue items</strong></td></tr>’);

$("#issues-table .overdue").parents("tr").insertAfter("#overduetr");

};

$("#issues-table th:first").off("click").removeClass();

});

//END Move overdues to the top of the table
[/code]

Before the code it looks like this:

Checkouts

And after:

Checkouts with JQuery

Read more by ByWater Partners

Tags jquery tutorial