Documentation ¶
Index ¶
- Constants
- func ApplyFormat(data interface{}, format string, timeFormat string) string
- type AliasColumn
- type AliasGetter
- type AliasTexter
- type CellTexter
- type CheckboxColumn
- func (c *CheckboxColumn) Action(ctx context.Context, params page.ActionParams)
- func (c *CheckboxColumn) AddActions(t page.ControlI)
- func (c *CheckboxColumn) CellText(ctx context.Context, row int, col int, data interface{}) string
- func (c *CheckboxColumn) Changes() map[string]bool
- func (c *CheckboxColumn) CheckboxAttributes(data interface{}) *html.Attributes
- func (c *CheckboxColumn) HeaderCellHtml(ctx context.Context, row int, col int) (h string)
- func (c *CheckboxColumn) Init()
- func (c *CheckboxColumn) SetShowCheckAll(s bool) *CheckboxColumn
- func (c *CheckboxColumn) UpdateFormValues(ctx *page.Context)
- type CheckboxColumnI
- type CheckboxProvider
- type CustomColumn
- type Getter
- type GetterColumn
- type GetterTexter
- type MapColumn
- type MapTexter
- type NodeColumn
- type NodeTexter
- type ProxyCellTexter
- type ProxyColumn
- type SliceColumn
- type SliceTexter
- type StringGetter
Constants ¶
const (
AllClickAction = iota + 1000
)
Variables ¶
This section is empty.
Functions ¶
func ApplyFormat ¶
Types ¶
type AliasColumn ¶
type AliasColumn struct { control.ColumnBase // contains filtered or unexported fields }
AliasColumn is a column that uses the AliasGetter interface to get the alias text out of a database object. The data therefore should be a slice of objects that implement the AliasGetter interface. All ORM objects are AliasGetters (or should be).
func NewAliasColumn ¶
func NewAliasColumn(alias string, format ...string) *AliasColumn
NewAliasColumn creates a new table column that gets its text from an alias attached to an ORM object.
func NewDateAliasColumn ¶
func NewDateAliasColumn(alias string, timeFormat string, format ...string) *AliasColumn
NewAliasColumn creates a new table column that gets its text from an alias attached to an ORM object. The alias should get a DateTime type of data.
func (*AliasColumn) Init ¶
func (c *AliasColumn) Init(alias string, format string, timeFormat string)
func (*AliasColumn) SetFormat ¶
func (c *AliasColumn) SetFormat(format string) *AliasColumn
SetFormat sets the format string of the node column.
func (*AliasColumn) SetTimeFormat ¶
func (c *AliasColumn) SetTimeFormat(format string) *AliasColumn
SetTimeFormat sets the time format of the string, specifically for a DateTime column.
type AliasGetter ¶
type AliasGetter interface {
GetAlias(key string) query.AliasValue
}
type AliasTexter ¶
type AliasTexter struct { // Alias is the alias name in the database object that we are interested in. Alias string // Format is a format string. It will be applied using fmt.Sprintf. If you don't provide a Format string, standard // string conversion operations will be used. Format string // TimeFormat is applied to the data using time.Format. You can have both a Format and TimeFormat, and the Format // will be applied using fmt.Sprintf after the TimeFormat is applied using time.Format. TimeFormat string }
AliasTexter gets text out of an ORM object with an alias. If the alias does not exist, it will panic.
type CellTexter ¶
type CellTexter interface { control.CellTexter }
type CheckboxColumn ¶
type CheckboxColumn struct { control.ColumnBase // contains filtered or unexported fields }
CheckboxColumn is a table that contains a checkbox. You must provide it a CheckboxProvider to connect ids and default data to the checkbox. Use Changes() to get the list of checkbox ids that have changed since the list was initially drawn.
func NewCheckboxColumn ¶
func NewCheckboxColumn(p CheckboxProvider) *CheckboxColumn
NewChecboxColumn creates a new table table that contains a checkbox. You must provide the id of the parent table, add a CheckboxProvider which will connect checkbox states to data states
The table will keep track of what checkboxes have been clicked and the new values. Call Changes() to get those changes. Or, if you are recording your changes in real time, attach a CheckboxColumnClick event to the table.
func (*CheckboxColumn) Action ¶
func (c *CheckboxColumn) Action(ctx context.Context, params page.ActionParams)
func (*CheckboxColumn) AddActions ¶
func (c *CheckboxColumn) AddActions(t page.ControlI)
AddActions adds actions to the table that the column can respond to.
func (*CheckboxColumn) Changes ¶
func (c *CheckboxColumn) Changes() map[string]bool
Changes returns a map of ids corresponding to checkboxes that have changed. Both true and false values indicate the current state of that particular checkbox. Note that if a user checks a box, then checks it again, even though it is back to its original value, it will still show up in the changes list.
func (*CheckboxColumn) CheckboxAttributes ¶
func (c *CheckboxColumn) CheckboxAttributes(data interface{}) *html.Attributes
CheckboxAttributes returns the attributes for the input tag that will display the checkbox. If data is nil, it indicates a checkAll box.
func (*CheckboxColumn) HeaderCellHtml ¶
func (*CheckboxColumn) Init ¶
func (c *CheckboxColumn) Init()
func (*CheckboxColumn) SetShowCheckAll ¶
func (c *CheckboxColumn) SetShowCheckAll(s bool) *CheckboxColumn
func (*CheckboxColumn) UpdateFormValues ¶
func (c *CheckboxColumn) UpdateFormValues(ctx *page.Context)
UpdateFormValues will look for changes to our checkboxes and record those changes.
type CheckboxColumnI ¶
type CheckboxColumnI interface { control.ColumnI CheckboxAttributes(data interface{}) *html.Attributes }
type CheckboxProvider ¶
type CheckboxProvider interface { // Id should return a unique id corresponding to the data. It is used to track the checked state of the checkbox. ID(data interface{}) string // IsChecked should return true if the checkbox corresponding to the row data should initially be checked. After the // initial draw, the table will keep track of the state of the checkbox, meaning you do not need to live update your data. // If you are using the table just as a selction of items to act on, just return false here. IsChecked(data interface{}) bool // Attributes returns the attributes that will be applied to the checkbox corresponding to the data row. // Use this primarily for providing custom attributes. Return nil if you have no custom attributes. Attributes(data interface{}) *html.Attributes // If you enable the checkAll box, you can use this to return a map of all the ids and their inital values here. This is // mostly helpful if your table is not showing all the rows at once (i.e. you are using a paginator or scroller and // only showing a subset of data at one time). If your table is show a checkAll box, and you return nil here, the // checkAll will only perform a javascript checkAll, and thus only check the visible items. All() map[string]bool }
type CustomColumn ¶
type CustomColumn struct {
control.ColumnBase
}
CustomColumn is a table column that you can customize any way you want. You simply give it a CellTexter, and return the text or html from the cell texter. One convenient way to use this is to define a CellText function on your form object and make it the cell texter.
func NewCustomColumn ¶
func NewCustomColumn(texter CellTexter, isHtml bool) *CustomColumn
NewCustomColumn creates a new column with a custom cell texter.
Set isHtml to true to indicate that the cell texter is returning html and not plain text.
func (*CustomColumn) Init ¶
func (c *CustomColumn) Init(texter CellTexter, isHtml bool)
type GetterColumn ¶
type GetterColumn struct {
control.ColumnBase
}
GetterColumn is a column that uses the Getter interface to get the text out of columns. The data therefore should be a slice of objects that implement the Getter interface.
func NewDateGetterColumn ¶
func NewDateGetterColumn(index string, timeFormat string, format ...string) *GetterColumn
func NewGetterColumn ¶
func NewGetterColumn(index string, format ...string) *GetterColumn
func (*GetterColumn) Init ¶
func (c *GetterColumn) Init(index string, format string, timeFormat string)
func (*GetterColumn) SetFormat ¶
func (c *GetterColumn) SetFormat(format string) *GetterColumn
func (*GetterColumn) SetTimeFormat ¶
func (c *GetterColumn) SetTimeFormat(format string) *GetterColumn
type GetterTexter ¶
type GetterTexter struct { // Key is the key to use when calling the Get function on the object. Key string // Format is a format string. It will be applied using fmt.Sprintf. If you don't provide a Format string, standard // string conversion operations will be used. Format string // TimeFormat is applied to the data using time.Format. You can have both a Format and TimeFormat, and the Format // will be applied using fmt.Sprintf after the TimeFormat is applied using time.Format. TimeFormat string }
GetterTexter lets you get items out of map like objects using the Getter interface.
type MapColumn ¶
type MapColumn struct {
control.ColumnBase
}
MapColumn is a table that works with data that is in the form of a slice. The data item itself must be convertable into a string, either by normal string conversion symantecs, or using the supplied format string. The format string will be applied to a date if the data is a date, or to the string using fmt.Sprintf
func NewMapColumn ¶
func NewTimeMapColumn ¶
func (*MapColumn) SetTimeFormat ¶
type MapTexter ¶
type MapTexter struct { // Index is the index into the data that corresponds to this table Index interface{} // Format is a format string. It will be applied using fmt.Sprintf. If you don't provide a Format string, standard // string conversion operations will be used. Format string // TimeFormat is applied to the data using time.Format. You can have both a Format and TimeFormat, and the Format // will be applied using fmt.Sprintf after the TimeFormat is applied using time.Format. TimeFormat string }
MapTexter is the default CellTexter for tables. It lets you get items out of maps.
type NodeColumn ¶
type NodeColumn struct { control.ColumnBase // contains filtered or unexported fields }
NodeColumn is a column that uses a query.NodeI to get its text out of data that is coming from the ORM.
func NewDateNodeColumn ¶
func NewDateNodeColumn(node query.NodeI, timeFormat string, format ...string) *NodeColumn
NewDateNodeColumn creates a table column that uses a query.NodeI object to get a date out of an ORM object. node should point to data that is preloaded in the ORM object. timeFormat is a time format string for formatting the date. format is optional and if specified, should be a format string suitable for the fmt package.
func NewNodeColumn ¶
func NewNodeColumn(node query.NodeI, format ...string) *NodeColumn
NewNodeColumn creates a table column that uses a query.NodeI object to get its text out of an ORM object. node should point to data that is preloaded in the ORM object. format is optional and if specified, should be a format string suitable for the fmt package.
func (*NodeColumn) Init ¶
func (c *NodeColumn) Init(node query.NodeI, format string, timeFormat string)
func (*NodeColumn) SetFormat ¶
func (c *NodeColumn) SetFormat(format string) *NodeColumn
SetFormat sets the format string of the node column.
func (*NodeColumn) SetTimeFormat ¶
func (c *NodeColumn) SetTimeFormat(format string) *NodeColumn
SetTimeFormat sets the time format of the string, specifically for a DateTime column.
type NodeTexter ¶
type NodeTexter struct { // Key is the key to use when calling the Get function on the object. Node query.NodeI // Format is a format string. It will be applied using fmt.Sprintf. If you don't provide a Format string, standard // string conversion operations will be used. Format string // TimeFormat is applied to the data using time.Format. You can have both a Format and TimeFormat, and the Format // will be applied using fmt.Sprintf after the TimeFormat is applied using time.Format. TimeFormat string }
NodeTexter is used by the NodeColumn to get text out of a database column.
type ProxyCellTexter ¶
type ProxyCellTexter interface { control.ProxyI CellTexter }
type ProxyColumn ¶
type ProxyColumn struct { control.ColumnBase Proxy ProxyCellTexter }
ProxyColumn is a table column that prints the output of a Proxy control. To use it, you must define your own proxy control that also has a CellText method attached to it, so that it satisfies the ProxyCellTexter interface above
func NewProxyColumn ¶
func NewProxyColumn(proxy ProxyCellTexter) *ProxyColumn
NewProxyColumn creates a new column with a custom cell texter.
Set isHtml to true to indicate that the cell texter is returning html and not plain text.
func (*ProxyColumn) Init ¶
func (c *ProxyColumn) Init(proxy ProxyCellTexter)
type SliceColumn ¶
type SliceColumn struct {
control.ColumnBase
}
SliceColumn is a table that works with data that is in the form of a slice. The data item itself must be convertable into a string, either by normal string conversion symantecs, or using the supplied format string.
func NewSliceColumn ¶
func NewSliceColumn(index int, format ...string) *SliceColumn
func NewTimeSliceColumn ¶
func NewTimeSliceColumn(index int, timeFormat string, format ...string) *SliceColumn
func (*SliceColumn) SetFormat ¶
func (c *SliceColumn) SetFormat(format string) *SliceColumn
func (*SliceColumn) SetTimeFormat ¶
func (c *SliceColumn) SetTimeFormat(format string) *SliceColumn
type SliceTexter ¶
type SliceTexter struct { // Index is the index into the data that corresponds to this table Index int // Format is a format string. It will be applied using fmt.Sprintf. If you don't provide a Format string, standard // string conversion operations will be used. Format string // TimeFormat is applied to the data using time.Format. You can have both a Format and TimeFormat, and the Format // will be applied using fmt.Sprintf after the TimeFormat is applied using time.Format. TimeFormat string }
SliceTexter is the default CellTexter for tables. It lets you get items out of slices.