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

Improve cell rendering #74

Open
greg-1-anderson opened this issue Oct 23, 2018 · 3 comments
Open

Improve cell rendering #74

greg-1-anderson opened this issue Oct 23, 2018 · 3 comments

Comments

@greg-1-anderson
Copy link
Member

NumericCellRenderer currently exists in StructuredData, and includes facilities both for formatting numbers and for right-justifying content in a cell.

Instead, we should have a Render directory. It should have a class that allows different decorators to be attached to cells either by field name or by cell data type. A number of renderers should be available, including numeric, date, right-justification and so on.

@wimleers
Copy link
Contributor

I had to resort to things like

sprintf("%6d", $number)

to get right-justifying numeric columns. Am I doing something wrong? 🤔

@greg-1-anderson
Copy link
Member Author

Were you using a custom renderer? Did you try NumericCellRenderer?

@manarth
Copy link

manarth commented Jan 6, 2024

I've not been able to get the NumericCellRenderer to work (with Drush 12.4.3.0).

    $result = new RowsOfFields($data);
    $result = $result->addRenderer(new NumericCellRenderer($data, ['count']));
    return $result;

I would expect the count column to be right-aligned and have commas as a thousands separator.
The number is displayed unformatted.

I'm going to have a look at the test for the NumericCellRenderer to see if that sheds light on the issue.

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

No branches or pull requests

3 participants