Skip to content

feature request: alignment setting #3

@philpennock

Description

@philpennock

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions