question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow configuration of text alignment for number/text cells

See original GitHub issue

Numbers are usually right aligned in spreadsheet software (e.g. Excel and Google Sheets) since it makes it easier to compare numbers:

image

I would love to have an option in glide-data-grid as well to right-align the rendered text in a cell. I build my own custom cell to do this using the textAlign canvas configuration, but I love to have this integrated directly into the core of glide-data-grid. I think there are two good options for this:

  • Option 1 (preferred): Provide the text alignment as part of the theme. This would allow the most flexibility since the theme can be already overwritten for any column, row, or individual cell.

  • Option 2: Provide an alignment property for NumberCell (or other text-based cells) which is applied to that cell.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
jassmithcommented, May 20, 2022

This is now in 4.0.4

1reaction
jassmithcommented, May 10, 2022

So after some digging about I think the solution is to provide both a textDirection and textAlign in the base cell. Changing this may have some serious performance impacts if it changes regularly from cell to cell when scanning column by column. This is because the cavnas will reload the font each time if that happens. Also mixed textDirection and textAlign (e.g rtl + right align) cannot be done without measuring the text which will also introduce some mild overhead. This should not impact default options but its worth knowing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Align text in Numbers on Mac - Apple Support
In Numbers on your Mac, align or justify paragraphs vertically and horizontally in a column, table cell, text box, or shape.
Read more >
Align text in a cell - Microsoft Support
Select the cells that have the text you want aligned. On the Home tab choose one of the following alignment options: Alignment of...
Read more >
Excel format for number, text, scientific notation, accounting, etc.
How to format cells in Excel (number, text, scientific notation, etc.) ... The below screenshot shows the default Alignment tab settings:
Read more >
Excel XP: Text and Cell Alignments - GCF Global
The fourth type of cell alignment in the Format Cells dialog box is text orientation, which allows text to be oriented 90 degrees...
Read more >
Formatting Numbers as Text - LibreOffice Help
... filteraligning -- cellsaligning -- objectsaligning -- paragraphsaligning ... layout -- definitioncomplex text layout -- enablingcomplex text layout, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found