![Coverage](https://img.shields.io/badge/Coverage-84.3%25-brightgreen)
Table with header row for Fyne UI library
About
fyne-headertable is a set of custom widgets for the Fyne
toolkit that enhances Fyne's existing Table widget by adding
headers for the columns.
A simple yet configurable header for data
![HeaderTable screenshot](https://github.com/PaulWaldo/fyne-headertable/raw/v0.0.2/docs/HeaderTable.png)
A header that allows your users to sort the data in your table
![SortingHeaderTable screenshot](https://github.com/PaulWaldo/fyne-headertable/raw/v0.0.2/docs/SortingHeaderTable.png)
Demos
To see the simple header in action, run
go run headertable/cmd/plainheader/main.go
This will create a table with static headers.
This demo illustrates how changes to the underlying data store are reflected in the table
by periodically changing values in the binding store.
The sorting header table is shown by running
go run headertable/cmd/sortheader/main.go
This illustrates sortable headers where selecting the sort icon sorts the underlying data.
Implementing
Take a look at the samples for details, but the basic procedure is
- Create a
struct
that defines the data in the table
- Create an array of the type and populate it with data
- Create an array of fyne Bindings using
binding.BindStruct
for each data element
- Create a
headertable.TableOpts
instance to hold
ColAttrs
array that describes layout of the column header's text including:
- Alignment
- Style
- Wrapping
- Width
RefWidth
string that is the basis for sizing the columns
Bindings
the bindings created above
- Create a Header Table using
headertable.NewHeaderTable
- Add the Header Table to the layout
To Do
- Fix problem where header table and data table become horizontally out of sync
Acknowledgements
A special thanks to rohanthewiz (Rohan Allison)
for providing a basis for these widgets in his rohanthewiz/rtable: RTable is a thin wrapper around fyne table repo!