cca / koha_snippets

code to be pasted into Koha's admin side
https://library.cca.edu
Other
4 stars 0 forks source link

AVAILABLE status spans two lines in OPAC #39

Closed phette23 closed 1 year ago

phette23 commented 1 year ago

Awkwardly, the "AVAILABLE" status text is just barely too long to fit in the Status column now on serials (does not affect most item types, it appers):

Screenshot 2023-06-20 at 1 26 30 PM

It must be because of the introduction of a new column into the holdings table in 22.11? Maybe "Item holds" wasn't there before? Or there was some slight typographic or layout change that caused this.

phette23 commented 1 year ago

This is actually caused by our holdings-table-filter.js script, it does not take the new table settings into account. We probably need to rethink how this is done or remove it entirely.

phette23 commented 1 year ago

Looking at the bib details source code, it seems like we should be able to call the KohaTable function again instructing it to destroy the existing datatable and make the new one sortable/searchable:

KohaTable("#holdingst", {
        dom: '<"clearfix">t',
        "columnDefs": [
            { "targets": [-1], "sortable": true, "searchable": true },
        ],
        "bKohaColumnsUseNames": true,
        "autoWidth": false,
        "destroy": true
    }, columns_settings);

where column_settings is a large array of settings for each column like { "columnname": "item_cover", "is_hidden": 0, "cannot_be_toggled": 0, "cannot_be_modified": 0 } for each item datum where is_hidden === 1 for the columns we've marked hidden in our table settings. However, this KohaTable call does not work, it once again shows all columns in the table and there are no search nor sorting controls.

phette23 commented 1 year ago

OK so the above approach only didn't work because the f parameter for filter needed to be added to the datatable dom setting, merely setting searchable to true does not add the search filter to DOM.

Viewing Koha's table source code is helpful for understanding how things work. The dom datatable option is also useful for understanding that string's complex syntax.