Hello Rajesh,
I usually have my own: MyApp::REST which extends
package MyApp::REST;
use Moose;
use Try::Tiny;
use DBIx::Class::ResultSet::RecursiveUpdate;
use Scalar::Util qw( reftype );
BEGIN { extends 'Catalyst::Controller::DBIC::API::REST' }
with 'Iris::Web::TraitFor::Controller::Datatables';
….
and later on modifier:
=head2 list_format_output
Add more information about current search
=cut
after 'list_format_output' => sub {
my ($self, $c) = @_;
if (!$self->has_errors($c) && $c->req->has_search_total_entries) {
my $current_result_set = $c->req->current_result_set;
$c->stash->{ $self->stash_key }{last_page} =
$current_result_set->pager->last_page + 0;
$c->stash->{ $self->stash_key }{current_page} =
$current_result_set->pager->current_page + 0;
$c->stash->{ $self->stash_key }{entries_per_page} =
$current_result_set->pager->entries_per_page + 0;
$c->stash->{ $self->stash_key }{entries_on_this_page} =
$current_result_set->pager->entries_on_this_page + 0;
}
};
Best regards,
>
> On Mar 19, 2017, at 09:28, Rajesh Kumar Mallah <[email protected]> wrote:
>
> Hi ,
>
> We know that Catalyst::Controller::DBIC::API supports paging
> via list_count , list_page and list_offset options and
> its possible to fetch a page of a large result set.
>
> However what it does not seems to support is to tell
> the View(caller) of how many records in total exists , ie
> the total_entries of the Data::Page object.
>
> This compels us to make two queries one to get the total count
> and another to get the paged result.
>
> Does this feature really does not exists or am I missing something?
>
> (The reason I love and thoroughly use Catalyst::Controller::DBIC::API is
> that it allows me to be lazy :p )
>
> regds
> Rajesh Kumar Mallah.
>
>
>
>
> _______________________________________________
> List: [email protected]
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/