Open greg-1-anderson opened 5 years ago
I had to resort to things like
sprintf("%6d", $number)
to get right-justifying numeric columns. Am I doing something wrong? 🤔
Were you using a custom renderer? Did you try NumericCellRenderer?
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.
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.