Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Building Tables in Catalyst

by TheHobbit (Pilgrim)
on Apr 17, 2013 at 18:50 UTC ( [id://1029197]=perlquestion: print w/replies, xml ) Need Help??

TheHobbit has asked for the wisdom of the Perl Monks concerning the following question:

Greetings monks,
I'm looking for a module analogous of HTML::FormBuilder, but targeted to build tables to be used in a Catalyst app.

Ideally, I would have to define a table class with something like

package MyApp::Tables::MyTable; use Some::Fantastic::TableBuilder; has_column column_name => ( # various named parameters );

Here, has_column should be some analogous of has_field in HTML::FormBuilder

Then, in my controller I'll do something like

sub show :Local { my $data = fetch_tabular_data_from_model(); my $table = MyApp::Tables::MyTable->new(); $table->set_data($data); $c->stash(table => $table); $c->stash(template => 'mytable.tt2'); }
Here tabular data means something like a Data::Table instance, or a sequence of row object, such as that returned by a DBIC search.

Later, in mytable.tt2 TT template I'll have a line with

[% table.render %]
and all will magically work :)

For all to magically work I need, at the very least, to be able to put wrappers around things (whole table, rows, individual cells...) by defining wrapper methods/classes as in HTML::FormBuilder

Now there are the questions. First, does a module such as this, or something approaching it, exists? If not, would it be interesting to have it?


Leo TheHobbit

Replies are listed 'Best First'.
Re: Building Tables in Catalyst
by Anonymous Monk on Apr 18, 2013 at 04:29 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1029197]
Approved by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-19 21:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found