climate
climate copied to clipboard
Proposal: center or right-align table columns?
Hey there, what do you think of centering column contents, or aligning (numbers) to the right?
As far as I can see, there is a buildCell method that calls another pad method and also already knows the column width. Roughly outline as use example:
<?php
$climate->table($data, [
// STR_PAD_RIGHT or null is default anyway
// 'name' => STR_PAD_RIGHT,
'age' => STR_PAD_LEFT,
'centered' => STR_PAD_BOTH
]);
And inside the Table class, I imagine:
protected function buildCell($key, $column)
{
$align = $this->column_aligns[$key];
$width = $this->column_widths[$key];
return $this->pad($column, $width, $align);
}
Regards
Hi @tomkyle, that sounds like an interesting idea, I'll take a look when I get a minute
Would be nice if this were to be implemented