Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Using rowspan with CGI.pm

by donarb (Beadle)
on Jun 26, 2005 at 18:28 UTC ( #470055=note: print w/replies, xml ) Need Help??


in reply to Using rowspan with CGI.pm

The problem is that you are pushing each created <td> onto the @rows array, then using that array to create table rows at the end. What you should do is create the row using just the <td>s for that row and push that onto the @rows array. At the end, you can just use the @rows array as an argument to table(). Your code should look like this:
my @rows; my @headings = (th(['Foo','Bar'])); push(@rows, Tr(@headings)); my @row1 = (td({-rowspan=>'2'},'foo1')); push(@row1,td('bar1')); push(@rows,Tr(@row1)); my @row2 = (td(['bar2'])); push(@rows,Tr(@row2)); my @row3 = (td({-rowspan=>'2'},'foo2')); push(@row3,td('bar3')); push(@rows,Tr(@row3)); my @row4 = (td(['bar4'])); push(@rows,Tr(@row4)); print start_html('foobar'), table({-border=>'1'},@rows), end_html;
The above code produces:

Foo Bar
foo1 bar1
bar2
foo2 bar3
bar4

Replies are listed 'Best First'.
Re^2: Using rowspan with CGI.pm
by loris (Hermit) on Jun 27, 2005 at 07:12 UTC

    That was exactly what I needed.

    Thanks very much, donarb.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2022-01-28 12:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (73 votes). Check out past polls.

    Notices?