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

feature request: alignment setting #3

Open
philpennock opened this issue Nov 30, 2016 · 0 comments
Open

feature request: alignment setting #3

philpennock opened this issue Nov 30, 2016 · 0 comments
Assignees

Comments

@philpennock
Copy link
Member

Per TODO notes in table.go -- we should be able to set alignment on cells.

This should be a property stored, columns should be the main use-case, individual cells a second. The property side won't care, but the API will.

I suspect that we want two types of interface:

  • row.AddCellWithOptions(item interface{}, options tabular.Options)
  • tbl.SetOptions(location tabular.CellLocation, options tabular.Options)

The location approach can use 0 for "unspecified, so that it becomes tabular.CellLocation{Column: 2}. The option-setting logic then parses that to figure out where to set the properties.

Do we want options to be properties, or a lighter shim around them?

For the alignment:

  • ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER
  • ALIGN_NUMERIC ? What locale issues here?
  • ALIGN_FUNCTION ... via just using a function, which satisfies an interface? Specifies offset into character-cell-width for using for alignment, for a given table cell, and so a simple implementation might search for the right-most "."

Probably use an interface, period, but have a type used for the ALIGN_foo constants, and the method upon that type use the value as input.

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

1 participant