|
Lines 40-47
Koha::Template::Plugin::TablesSettings
Link Here
|
| 40 |
. . . |
40 |
. . . |
| 41 |
|
41 |
|
| 42 |
<script> |
42 |
<script> |
| 43 |
var columns_settings = [% TablesSettings.GetColumns( 'module', 'page', 'table', 'json' ) | $raw %]; |
43 |
var table_settings = [% TablesSettings.GetTableSettings( 'module', 'page', 'table', 'json' ) | $raw %]; |
| 44 |
var table = KohaTable("id", { "autoWidth": false }, columns_settings ); |
44 |
var table = $("#id").kohaTable({ "autoWidth": false }, table_settings ); |
| 45 |
</script> |
45 |
</script> |
| 46 |
|
46 |
|
| 47 |
This plugin allows to get the column configuration for a table. It should be used both in table markup |
47 |
This plugin allows to get the column configuration for a table. It should be used both in table markup |
|
Lines 61-100
use C4::Utils::DataTables::TablesSettings;
Link Here
|
| 61 |
|
61 |
|
| 62 |
=head1 FUNCTIONS |
62 |
=head1 FUNCTIONS |
| 63 |
|
63 |
|
| 64 |
=head2 GetColumns |
|
|
| 65 |
|
| 66 |
<script> |
| 67 |
var tables_settings = [% TablesSettings.GetColumns( 'module', 'page', 'table', 'json' ) | $raw %]; |
| 68 |
var table = KohaTable("id", { "autoWidth": false }, tables_settings ); |
| 69 |
</script> |
| 70 |
|
| 71 |
Used to get the full column settings configuration for datatables, usually requires a format of 'json' to pass into |
| 72 |
datatables instantiator. |
| 73 |
|
| 74 |
=cut |
| 75 |
|
| 76 |
=head3 GetColumns |
| 77 |
|
| 78 |
var columns_settings = [% TablesSettings.GetColumns( module, page, table 'json' ) | $raw%] |
| 79 |
|
| 80 |
This method is usually be used to retrieve the columns settings for a DataTable init. |
| 81 |
|
| 82 |
So the 'json' format will be provided and the columns_settings JS var will be |
| 83 |
passed as argument of the constructor. |
| 84 |
|
| 85 |
=cut |
| 86 |
|
| 87 |
sub GetColumns { |
| 88 |
my ( $self, $module, $page, $table, $format ) = @_; |
| 89 |
$format //= q{}; |
| 90 |
|
| 91 |
my $columns = C4::Utils::DataTables::TablesSettings::get_columns( $module, $page, $table ); |
| 92 |
|
| 93 |
return $format eq 'json' |
| 94 |
? to_json( $columns ) |
| 95 |
: $columns |
| 96 |
} |
| 97 |
|
| 98 |
=head2 is_hidden |
64 |
=head2 is_hidden |
| 99 |
|
65 |
|
| 100 |
[% UNLESS TablesSettings.is_hidden( 'module', 'page', 'table', 'column') %] |
66 |
[% UNLESS TablesSettings.is_hidden( 'module', 'page', 'table', 'column') %] |
| 101 |
- |
|
|