Skip to content

PaulWaldo/fyne-headertable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fyne-headertable

Coverage

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.

Widgets

HeaderTable

A simple yet configurable header for data

HeaderTable screenshot

SortingHeaderTable

A header that allows your users to sort the data in your table

SortingHeaderTable screenshot

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

  1. Create a struct that defines the data in the table
  2. Create an array of the type and populate it with data
  3. Create an array of fyne Bindings using binding.BindStruct for each data element
  4. 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
  5. Create a Header Table using headertable.NewHeaderTable
  6. 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!