Home » Console » Console_Table » Bug #4299
Cell Sizing Issues
Details
| Submitted | 2005-05-06 19:46 UTC |
|---|---|
| From | mulka at umich dot edu |
| Assigned | yunosh |
| Status | Closed |
| Package | Console_Table |
| PHP Version | 4.3.5 |
| Roadmaps | (Not assigned) |
Comments
[2005-05-06 19:46 UTC] mulka at umich dot edu
Description:
------------
The cell sizing is not working properly between the headers and the data. It seems to size them separately, and therefore causes the columns to not line up.
Reproduce code:
---------------
require_once "ConsoleTable.php";
$headers = array (
'name' => 'Lake Name',
'county' => 'County',
'township' => 'Township',
'section' => 'Section',
'site' => 'Site Name',
'latitude' => 'Latitude',
'longitude' => 'Longitude',
);
$data = array (
0 =>
array (
'name' => 'Crystal',
'county' => 'Benzie',
'township' => NULL,
'section' => NULL,
),
1 =>
array (
'name' => 'Ann',
'county' => '',
'township' => NULL,
'section' => NULL,
),
2 =>
array (
'name' => 'Ann',
'county' => '',
'township' => NULL,
'section' => NULL,
)
);
$table = new Console_Table();
$table->setHeaders($headers);
$table->addData($data);
print $table->getTable();
Expected result:
----------------
+-----------+--------+----------+---------+-----------+----------+-----------+
| Lake Name | County | Township | Section | Site Name | Latitude | Longitude |
+-----------+--------+----------+---------+-----------+----------+-----------+
| Crystal | Benzie | | | | | |
| Ann | | | | | | |
| Ann | | | | | | |
+-----------+--------+----------+---------+-----------+----------+-----------+
Actual result:
--------------
+---------+--------+--+--+--+--+--+
| Lake Name | County | Township | Section | Site Name | Latitude | Longitude | | | | | | | |
+---------+--------+--+--+--+--+--+
| Crystal | Benzie | | | | | |
| Ann | | | | | | |
| Ann | | | | | | |
+---------+--------+--+--+--+--+--+