<<

NAME

Koha::Template::Plugin::TablesSettings

SYNOPSYS

    [% USE TablesSettings %]

    . . .

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

    . . .

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

    . . .

    <script>
        var columns_settings = [% TablesSettings.GetColumns( 'module', 'page', 'table', 'json' ) | $raw %];
        var table = KohaTable("id", { "autoWidth": 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 tables_settings = [% TablesSettings.GetColumns( 'module', 'page', 'table', 'json' ) | $raw %];
        var table = KohaTable("id", { "autoWidth": false }, tables_settings );
    </script>

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

GetColumns

var columns_settings = [% TablesSettings.GetColumns( module, page, table 'json' ) | $raw%]

This method is usually be used to retrieve the columns settings for a DataTable init.

So the 'json' format will be provided and the columns_settings JS var will be passed as argument of the constructor.

is_hidden

    [% UNLESS TablesSettings.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.

GetTableSettings

[% SET table_settings = GetTableSettings( module, page, table ) %]

This method is used to retrieve the tables settings (like table_settings.default_display_length and table_settings.default_sort_order). They can be passed to the DataTable constructor (for iDisplayLength and order parameters)

<<