[Catalyst] No data showing

will trillich will.trillich at serensoft.com
Fri Apr 27 15:52:49 GMT 2012


$c->model('ORANGES::AccountView')->search({},{order_by=3D>'account_code'})-=
>all()

I'd recommend that you look into iterating thru the recordset in the
template, instead of rendering all rows of data before it's rendered:

my $acct_rs =3D $c->model('ORANGE::AccountView')->*search_rs<http://search.=
cpan.org/~arodland/DBIx-Class-0.08196/lib/DBIx/Class/ResultSet.pm#search_rs>
*(
    {},
    {
        order_by =3D> 'account_code',
        page =3D> $page_no,
        rows =3D> $rows_per_page,
    },
);
$c->stash( accounts =3D> $acct_rs );

then in your template

[% WHILE ( acct =3D accounts.next ) %]

See
http://search.cpan.org/~danieltwc/DBIx-Class-0.07002/lib/DBIx/Class/Manual/=
Cookbook.pod#Searching



On Fri, Apr 27, 2012 at 10:09 AM, Kenneth S Mclane <ksmclane at us.ibm.com>wro=
te:

>
> I swear I tried that and it still didn't work. It does now, thank you. Can
> you tell me what I need to add to "$c->stash(accounts =3D> [
> $c->model('ORANGES::AccountView')->all ]);" to sort by the account_code in
> ascending order? It's obviously "sort, but the actual syntax is what I'm
> looking for. Thanks again.
>
>
>
>  From: Will Crawford <billcrawford1970 at gmail.com> To: The elegant MVC web
> framework <catalyst at lists.scsys.co.uk> Date: 04/27/2012 09:55 AM Subject:=
 Re:
> [Catalyst] No data showing
> ------------------------------
>
>
>
>
>
> On 27 April 2012 15:50, Kenneth S Mclane <*ksmclane at us.ibm.com*<ksmclane@=
us.ibm.com>>
> wrote:
> This was a test to make sure I was actually getting data. My intention is
> to return all rows in pager format. I haven't made it to that part yet.
> Here is my template code:
>
> <table width=3D"100%" border=3D"1">
>     <tr><th>Department</th><th>Account Code</th><th>Account
> Name</th><th>Policy</th><th>Compliant</th><th>Servers</th><th>Subsystems<=
/th><th>Complete</th><th>Status</th></tr>
>     [% # Display each account in a table row %]
>     [% FOREACH account IN accounts -%]
>                              ^^^^^^^
>       <tr>
>                 <td>1[% accounts.department_id %]</td>
>                                  ^^^^^^^^
>
> You're simply referring to the list instead of the item here.
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>


-- =

"We act as though comfort and luxury were the chief requirements of life,
when all that we need to make us happy is something to be enthusiastic
about." -- Albert Einstein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120427/c6b44=
ea7/attachment.htm


More information about the Catalyst mailing list