Nath, Alok (STSD) wrote:
Hi,
In my current program I am not sure where to use rowSpan so that I create table like below.
In otherwords, I want switch 1 to appear
once only for the two rows.

My main constraint is I dont want to change the program style to create such a table .

Any help will be greatly appreciated.


|--------------|------------|
|              |            |
|--------------|------------|
|              | Cell B     |
|switch1       |------------|
|              | Cell C     |
|--------------|------------|

print $cgi->table({
-border=>undef,
-width=>'100%', -height=>'20%',
-colSpan => 10,
},
$cgi->Tr({
-align=>'center',
-valign=>'top'
}, [
$cgi->th([
"Network Switch", "Slot 1", "Slot 2", "Network Switch"]),
]),
$cgi->Tr({
-align=>'center',
-valign=>'middle',

},
[
$cgi->td([
'{-rowSpan=> 2},Switch 1',
'CayenneE-1_B-1 ',
'CayenneE-1_B-2', "Switch 2"
]),
]),
$cgi->Tr({
-align=>'center',
-valign=>'middle',
},
[
$cgi->td([
'Switch 1',
'CayenneE-1 ',
'No Blade', "Switch 2"
]),
]),

) ;

You've made things very hard for yourself by laying out your code like this. and you have too many square brackets for comfort. Try this, it does what you want and, perhaps even more usefully, it /looks/ like it works.

HTH,

Rob


  use strict;
  use warnings;

  use CGI;

  my $cgi = new CGI;

  print $cgi->table(

    { -border=>undef, -width=>'100%',  -height=>'20%', -colSpan => 10, },

    $cgi->Tr(
      { -align=>'center', -valign=>'top', },
      $cgi->th([ "Network Switch",  "Slot 1",  "Slot 2",  "Network Switch" ]),
    ),

    $cgi->Tr(
      { -align=>'center', -valign=>'middle', },
      $cgi->td({-rowSpan=>2}, 'Switch 1'),
      $cgi->td([ 'CayenneE-1_B-1 ', 'CayenneE-1_B-2',  "Switch 2" ]),
    ),

    $cgi->Tr(
      { -align=>'center', -valign=>'middle', },
      $cgi->td([ 'CayenneE-1 ', 'No Blade',  "Switch 2" ]),
    ),

  ) ;

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to