https://github.com/giterlizzi/perl-mojolicious-plugin-datatables
Mojolicious Plugin for DataTables
https://github.com/giterlizzi/perl-mojolicious-plugin-datatables
datatables hacktoberfest mojolicious perl plugin
Last synced: 17 days ago
JSON representation
Mojolicious Plugin for DataTables
- Host: GitHub
- URL: https://github.com/giterlizzi/perl-mojolicious-plugin-datatables
- Owner: giterlizzi
- License: artistic-2.0
- Created: 2020-03-26T21:53:53.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-20T00:03:02.000Z (over 4 years ago)
- Last Synced: 2025-03-28T16:23:36.658Z (4 months ago)
- Topics: datatables, hacktoberfest, mojolicious, perl, plugin
- Language: Perl
- Homepage: https://metacpan.org/release/Mojolicious-Plugin-DataTables
- Size: 22.5 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/giterlizzi/perl-Mojolicious-Plugin-DataTables/releases) [](https://github.com/giterlizzi/perl-Mojolicious-Plugin-DataTables/actions) [](https://github.com/giterlizzi/perl-Mojolicious-Plugin-DataTables/actions) [](https://github.com/giterlizzi/perl-Mojolicious-Plugin-DataTables) [](https://github.com/giterlizzi/perl-Mojolicious-Plugin-DataTables) [](https://github.com/giterlizzi/perl-Mojolicious-Plugin-DataTables) [](https://github.com/giterlizzi/perl-Mojolicious-Plugin-DataTables/issues) [](https://coveralls.io/github/giterlizzi/perl-Mojolicious-Plugin-DataTables)
# Mojolicious::Plugin::DataTables
## Usage
```.pl
# Mojolicious
$self->plugin('DataTables');# Mojolicious::Lite
plugin 'DataTables';helper sql => sub { state $pg = Mojo::Pg->new('postgresql://postgres@/test') };
get '/users_table' => sub {
my $c = shift;
my $sql = $c->sql;my $dt_ssp = $c->datatable->ssp(
table => 'users',
sql => $sql,
options => [
{
label => 'UID',
db => 'uid',
dt => 0,
},
{
label => 'e-Mail',
db => 'mail',
dt => 1,
},
{
label => 'Status',
db => 'status',
dt => 2,
},
]
));$c->render(json => $dt_ssp);
};```
```.html
@@ template.html.ep<%= datatables_js %>
<%= datatables_css %>
UID
Status
jQuery('#users_table').DataTable({
serverSide : true,
ajax : '/users_table',
});
```
## Installation
To install this module type the following:
perl Makefile.PL
make
make test
make install## Copyright
Copyright (C) 2020-2021 by Giuseppe Di Terlizzi