<<

NAME

Koha::Template::Plugin::ColumnsSettings

SYNOPSYS

    [% USE ColumnsSettings %]

    . . .

    [% UNLESS ColumnsSettings.is_hidden( 'module', 'page', 'table', 'column') %]
        <th id="column" data-colname="column">Column title</th>
    [% END %]

    . . .

    [% UNLESS ColumnsSettings.is_hidden( 'module', 'page', 'table', 'column') %]
        <td>[% row.column %]</td>
    [% END %]

    . . .

    <script>
        var columns_settings = [% ColumnsSettings.GetColumns( 'module', 'page', 'table', 'json' ) | $raw %];
        var table = KohaTable("id", { "bAutoWidth": false }, columns_settings );
    </script>

This plugin allows to get the column configuration for a table. It should be used both in table markup and as the input for datatables visibility settings to take full effect.

FUNCTIONS

GetColumns

    <script>
        var columns_settings = [% ColumnsSettings.GetColumns( 'module', 'page', 'table', 'json' ) | $raw %];
        var table = KohaTable("id", { "bAutoWidth": false }, columns_settings );
    </script>

Used to get the full column settings configuration for datatables, usually requires a format of 'json' to pass into datatables instantiator.

is_hidden

    [% UNLESS ColumnsSettings.is_hidden( 'module', 'page', 'table', 'column') %]
        <th id="column" data-colname="column">Column title</th>
    [% END %]

Used to fetch an individual columns display status so we can fully hide a column in the markup for cases where it may contain confidential information and should be fully hidden rather than just hidden from display.

<<