Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

DBIx_XHTML_Table usage - Urgent Please

by Anonymous Monk
on Nov 21, 2006 at 04:16 UTC ( [id://585193]=perlquestion: print w/replies, xml ) Need Help??

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

Hi All, I am using DBIx_XHTML_Table for displaying Data in Tabular format. Its working fine. But i have one problem. When I am trying to insert link to a column is not working. Same thing works for all colunms. I am using map_cell function to create links.
$table->exec_query("$sql"); $table->modify(table => { width => '100%', cellspacing=> '2', cellpadding=>'5', 'border-style' => 'inset', 'border-width' => 'thin', }); $table->modify(th => { style => { color => '#FFFAF0', background => '#4682B4', 'text-align' => 'center', 'text-transform'=> 'uppercase', } },'head'); $table->modify(tr => { style => { background => ['#B0C4DE','#F0F8FF'], } }); $table->modify(td => { style => { 'text-align' => 'left', 'white-space' => 'nowrap', } }); $table->modify(td => { style => { 'text-align' => 'center', 'white-space' => 'nowrap', } },['Projects','Tasks','EstimatedDays','SpentDays']); $table->modify(th => { style => 'background: #FFF0F5' },'foot'); #$table->map_cell(sub { # my $datum = shift; # return qq|<a href="http://sctesrv.india/cgi/project/viewprojectdet +ail.cgi?projectid=P-$datum">"$datum"</a>|; #}); $table->map_cell( sub{ my $datum = shift; return qq|<a href="http://sctesrv.india/cgi/project/viewpro +jectdetail.cgi?projectid=P-$datum">"$datum"</a>|; }, ['Projects']); if (param('radio-report') eq 'Summary'){ $table->calc_totals(['Projects','Tasks','EstimatedDays','SpentDays']); }else{ $table->calc_totals(['Tasks','EstimatedDays','SpentDays']); }
Thanks in Advance.

Replies are listed 'Best First'.
Re: DBIx_XHTML_Table usage - Urgent Please
by Samy_rio (Vicar) on Nov 21, 2006 at 05:18 UTC

    Hi, your code looks good. Its working fine for me with hyperlink. In DBIx::XHTML_Table module, all the column names are in same case (lower or upper) as of database field name.

    Look the code:

    use DBIx::XHTML_Table; # database credentials - fill in the blanks my ($data_source,$usr,$pass) = (); my $table = DBIx::XHTML_Table->new('DBI:mysql:project', '', ''); $table->exec_query("select * from test"); $table->modify(table => { width => '100%', cellspacing=> '2', cellpadding=>'5', 'border-style' => 'inset', 'border-width' => 'thin', }); $table->modify(th => { style => { color => '#FFFAF0', background => '#4682B4', 'text-align' => 'center', 'text-transform'=> 'uppercase', } },'head'); $table->modify(tr => { style => { background => ['#B0C4DE','#F0F8FF'], } }); $table->modify(td => { style => { 'text-align' => 'left', 'white-space' => 'nowrap', } }); $table->modify(td => { style => { 'text-align' => 'center', 'white-space' => 'nowrap', } },['id']); $table->modify(th => { style => 'background: #FFF0F5' },'id'); $table->map_cell( sub{ my $datum = shift; return qq|<a href="http://sctesrv.india/cgi/project/viewpro +jectdetail.cgi?projectid=P-$datum">"$datum"</a>|; }, ['id']); print $table->output;

    Regards,
    Velusamy R.


    eval"print uc\"\\c$_\""for split'','j)@,/6%@0%2,`e@3!-9v2)/@|6%,53!-9@2~j';

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-25 10:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found