Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: center or right-align table columns? #123

Open
tomkyle opened this issue Jun 28, 2018 · 2 comments
Open

Proposal: center or right-align table columns? #123

tomkyle opened this issue Jun 28, 2018 · 2 comments

Comments

@tomkyle
Copy link

tomkyle commented Jun 28, 2018

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

@tomkyle tomkyle changed the title Center or right-align table columns? Proposal: center or right-align table columns? Jun 28, 2018
@duncan3dc
Copy link
Member

Hi @tomkyle, that sounds like an interesting idea, I'll take a look when I get a minute

@rotexdegba
Copy link

Would be nice if this were to be implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants