Documentation ¶
Overview ¶
Package control contains implementations of standard HTML controls in GoRADD. These controls generally fall under the following categories:
Standard html tags. For example, div, input, select, table, img
Controls specifically designed to edit database data, like INT, FLOAT or DATE fields
Controls that we need to support the manipulation of database relationships, like one-to-many relationships
Useful utility controls
See the button, [textbox], [list], [table] and [dialog] packages for controls specific to these common types.
Index ¶
- Constants
- Variables
- func Children(creators ...page.Creator) []page.Creator
- func GetCreatorID(c page.Creator) string
- func ImageCaptureEvent() *event.Event
- func MakeCreatorWrapperID(wrapperId string, childCreator page.Creator, postfix string) string
- type ActiveLink
- func (l *ActiveLink) ActiveAttributes() html5tag.Attributes
- func (l *ActiveLink) Deserialize(d page.Decoder)
- func (l *ActiveLink) DrawingAttributes(ctx context.Context) html5tag.Attributes
- func (l *ActiveLink) Init(parent page.ControlI, id string)
- func (l *ActiveLink) IsActive() bool
- func (l *ActiveLink) Serialize(e page.Encoder)
- func (l *ActiveLink) SetIsActive(isActive bool) ActiveLinkI
- type ActiveLinkCreator
- type ActiveLinkI
- type Canvas
- type CanvasCreator
- type CanvasI
- type DataBinder
- type DataManager
- func (d *DataManager) Deserialize(dec page.Decoder)
- func (d *DataManager) HasData() bool
- func (d *DataManager) HasDataProvider() bool
- func (d *DataManager) LoadData(ctx context.Context, owner DataManagerI)
- func (d *DataManager) RangeData(f func(int, interface{}) bool)
- func (d *DataManager) ResetData()
- func (d *DataManager) Serialize(e page.Encoder)
- func (d *DataManager) SetData(data interface{})
- func (d *DataManager) SetDataProvider(b DataBinder)
- func (d *DataManager) SetDataWithOffset(data interface{}, offset int)
- type DataManagerI
- type DataPager
- func (d *DataPager) ButtonProxy() *Proxy
- func (d *DataPager) CalcBunch() (pageStart, pageEnd int)
- func (d *DataPager) Deserialize(dec page.Decoder)
- func (d *DataPager) DoAction(_ context.Context, params action.Params)
- func (d *DataPager) DrawInnerHtml(_ context.Context, w io.Writer)
- func (d *DataPager) DrawPreRender(ctx context.Context, w io.Writer)
- func (d *DataPager) DrawingAttributes(ctx context.Context) html5tag.Attributes
- func (d *DataPager) Init(parent page.ControlI, id string, pagedControl PagedControlI)
- func (d *DataPager) MarshalState(m page.SavedState)
- func (d *DataPager) NextButtonsHtml() string
- func (d *DataPager) PageButtonsHtml(i int) string
- func (d *DataPager) PagedControl() PagedControlI
- func (d *DataPager) PreviousButtonsHtml() string
- func (d *DataPager) Serialize(e page.Encoder)
- func (d *DataPager) SetLabels(previous string, next string)
- func (d *DataPager) SetMaxPageButtons(b int)
- func (d *DataPager) SetObjectNames(singular string, plural string)
- func (d *DataPager) UnmarshalState(m page.SavedState)
- type DataPagerCreator
- type DataPagerI
- type DateTimeSpan
- func (s *DateTimeSpan) DateTime() time.Time
- func (s *DateTimeSpan) Deserialize(dec page.Decoder)
- func (s *DateTimeSpan) DrawInnerHtml(_ context.Context, w io.Writer)
- func (s *DateTimeSpan) DrawingAttributes(ctx context.Context) html5tag.Attributes
- func (s *DateTimeSpan) Init(parent page.ControlI, id string)
- func (s *DateTimeSpan) Serialize(e page.Encoder)
- func (s *DateTimeSpan) SetDateTime(d time.Time)
- func (s *DateTimeSpan) SetFormat(format string) *DateTimeSpan
- func (s *DateTimeSpan) SetValue(v interface{})
- func (s *DateTimeSpan) Value() interface{}
- type DateTimeSpanCreator
- type Fieldset
- type FieldsetCreator
- type FieldsetI
- type FormBase
- type FormFieldWrapper
- func (c *FormFieldWrapper) ChildValidationChanged()
- func (c *FormFieldWrapper) Deserialize(dec page.Decoder)
- func (c *FormFieldWrapper) DrawTag(ctx context.Context, w io.Writer)
- func (c *FormFieldWrapper) DrawingAttributes(ctx context.Context) html5tag.Attributes
- func (c *FormFieldWrapper) ErrorAttributes() html5tag.Attributes
- func (c *FormFieldWrapper) For() string
- func (c *FormFieldWrapper) Init(parent page.ControlI, id string)
- func (c *FormFieldWrapper) InstructionAttributes() html5tag.Attributes
- func (c *FormFieldWrapper) Instructions() string
- func (c *FormFieldWrapper) LabelAttributes() html5tag.Attributes
- func (c *FormFieldWrapper) Serialize(e page.Encoder)
- func (c *FormFieldWrapper) SetErrorAttributes(a html5tag.Attributes) FormFieldWrapperI
- func (c *FormFieldWrapper) SetFor(relatedId string) FormFieldWrapperI
- func (c *FormFieldWrapper) SetInstructionAttributes(a html5tag.Attributes) FormFieldWrapperI
- func (c *FormFieldWrapper) SetInstructions(i string) FormFieldWrapperI
- func (c *FormFieldWrapper) SetLabelAttributes(a html5tag.Attributes) FormFieldWrapperI
- func (c *FormFieldWrapper) SubTag() string
- func (c *FormFieldWrapper) Validate(_ context.Context) bool
- type FormFieldWrapperCreator
- type FormFieldWrapperI
- type GridLayoutBuilder
- func (g *GridLayoutBuilder) Build() string
- func (g *GridLayoutBuilder) ColumnCount(count int) *GridLayoutBuilder
- func (g *GridLayoutBuilder) Direction(placement LayoutDirection) *GridLayoutBuilder
- func (g *GridLayoutBuilder) Items(items []string) *GridLayoutBuilder
- func (g *GridLayoutBuilder) RowClass(t string) *GridLayoutBuilder
- func (g *GridLayoutBuilder) RowTag(t string) *GridLayoutBuilder
- type Image
- func (i *Image) Alt() string
- func (i *Image) Data() []byte
- func (i *Image) Deserialize(dec page.Decoder)
- func (i *Image) DrawingAttributes(ctx context.Context) html5tag.Attributes
- func (i *Image) Height() int
- func (i *Image) Init(parent page.ControlI, id string)
- func (i *Image) Serialize(e page.Encoder)
- func (i *Image) SetAlt(alt string) ImageI
- func (i *Image) SetData(data []byte) ImageI
- func (i *Image) SetHeight(height int) ImageI
- func (i *Image) SetMimeType(typ string) ImageI
- func (i *Image) SetSrc(src string) ImageI
- func (i *Image) SetWidth(width int) ImageI
- func (i *Image) Src() string
- func (i *Image) Width() int
- type ImageCapture
- func (i *ImageCapture) Data() []byte
- func (i *ImageCapture) Deserialize(dec page.Decoder)
- func (i *ImageCapture) DrawingAttributes(ctx context.Context) html5tag.Attributes
- func (i *ImageCapture) Init(parent page.ControlI, id string)
- func (i *ImageCapture) MarshalState(m page.SavedState)
- func (i *ImageCapture) Serialize(e page.Encoder)
- func (i *ImageCapture) SetData(data []byte)
- func (i *ImageCapture) SetMaskShape(shape ImageCaptureShape)
- func (i *ImageCapture) SetMimeType(typ string)
- func (i *ImageCapture) SetPixelSize(width int, height int)
- func (i *ImageCapture) SetQuality(quality float32)
- func (i *ImageCapture) SetZoom(zoom int)
- func (i *ImageCapture) TurnOff()
- func (i *ImageCapture) UnmarshalState(m page.SavedState)
- func (i *ImageCapture) UpdateFormValues(ctx context.Context)
- type ImageCaptureCreator
- type ImageCaptureI
- type ImageCaptureShape
- type ImageCreator
- type ImageI
- type LabelAttributer
- type LayoutDirection
- type Link
- type LinkCreator
- type LinkI
- type On
- type PagedControl
- func (c *PagedControl) AddDataPager(d DataPagerI)
- func (c *PagedControl) CalcPageCount() int
- func (c *PagedControl) Deserialize(dec page.Decoder)
- func (c *PagedControl) GetDataPagerIDs() []string
- func (c *PagedControl) HasDataPagers() bool
- func (c *PagedControl) MarshalState(m page.SavedState)
- func (c *PagedControl) PageNum() int
- func (c *PagedControl) PageSize() int
- func (c *PagedControl) Serialize(e page.Encoder)
- func (c *PagedControl) SetPageNum(n int)
- func (c *PagedControl) SetPageSize(size int)
- func (c *PagedControl) SetTotalItems(count uint)
- func (c *PagedControl) SliceOffsets() (start, end int)
- func (c *PagedControl) SqlLimits() (maxRowCount, offset int)
- func (c *PagedControl) TotalItems() int
- func (c *PagedControl) UnmarshalState(m page.SavedState)
- type PagedControlI
- type Panel
- type PanelCreator
- type PanelI
- type Proxy
- func (p *Proxy) ActionAttributes(actionValue string) html5tag.Attributes
- func (p *Proxy) ButtonHtml(label string, actionValue string, attributes html5tag.Attributes, ...) string
- func (p *Proxy) Draw(ctx context.Context, w io.Writer)
- func (p *Proxy) Init(parent page.ControlI, id string)
- func (p *Proxy) LinkHtml(ctx context.Context, label string, actionValue string, ...) string
- func (p *Proxy) OnSubmit(action action.ActionI) page.ControlI
- func (p *Proxy) TagHtml(label string, actionValue string, attributes html5tag.Attributes, tag string, ...) string
- func (p *Proxy) WrapEvent(eventName string, _ string, eventJs string, options map[string]interface{}) string
- type ProxyCreator
- type ProxyI
- type Repeater
- func (r *Repeater) Deserialize(dec page.Decoder)
- func (r *Repeater) DrawInnerHtml(ctx context.Context, w io.Writer)
- func (r *Repeater) DrawItem(ctx context.Context, i int, data interface{}, w io.Writer)
- func (r *Repeater) DrawTag(ctx context.Context, w io.Writer)
- func (r *Repeater) DrawingAttributes(ctx context.Context) html5tag.Attributes
- func (r *Repeater) Init(parent page.ControlI, id string)
- func (r *Repeater) MarshalState(m page.SavedState)
- func (r *Repeater) Restore()
- func (r *Repeater) Serialize(e page.Encoder)
- func (r *Repeater) SetItemHtmler(h RepeaterHtmler) RepeaterI
- func (r *Repeater) UnmarshalState(m page.SavedState)
- type RepeaterCreator
- type RepeaterHtmler
- type RepeaterI
- type Span
- type SpanCreator
- type SpanI
Constants ¶
const (
PageClick = iota + 1000
)
Variables ¶
var DefaultMaxPagerButtons = 10
DefaultMaxPagerButtons is the default maximum number of buttons to display on the pager. You can change this in an individual control, too.
var DefaultPagerPageSize = 10
DefaultPagerPageSize is the default number of items that a paged control will show. You can change this in an individual control, too.
Functions ¶
func Children ¶ added in v0.2.0
Children is a helper function for doing declarative control creation for child control creators. It returns the creators passed to it as a slice.
func GetCreatorID ¶ added in v0.2.0
GetCreatorID uses reflection to get the id of the given creator.
func ImageCaptureEvent ¶ added in v0.23.0
ImageCaptureEvent triggers when the capture button has been pressed on an ImageCapture control, and the image has been captured.
func MakeCreatorWrapperID ¶ added in v0.23.0
MakeCreatorWrapperID is used by Creators of wrapper controls to return the computed id of a parent control that wraps a control creator. This would be the id of the parent control, followed by the id of the child control, followed by the postfix.
Types ¶
type ActiveLink ¶ added in v0.21.0
type ActiveLink struct { Link // contains filtered or unexported fields }
ActiveLink is a link that has an active status.
You can give an ActiveLink a set of attributes to merge into the attributes of the html tag to indicate that it is active. This can form the basis of a variety of specialized HTML controls, like navbars, tabs, and accordions.
func GetActiveLink ¶ added in v0.21.0
func GetActiveLink(c page.ControlI, id string) *ActiveLink
GetActiveLink is a convenience method to return the link with the given id from the page.
func NewActiveLink ¶ added in v0.21.0
func NewActiveLink(parent page.ControlI, id string) *ActiveLink
NewActiveLink creates a new standard html link
func (*ActiveLink) ActiveAttributes ¶ added in v0.21.0
func (l *ActiveLink) ActiveAttributes() html5tag.Attributes
ActiveAttributes returns the attributes used to indicate the link is active. If you change them, be sure to call Refresh().
func (*ActiveLink) Deserialize ¶ added in v0.21.0
func (l *ActiveLink) Deserialize(d page.Decoder)
Deserialize reconstructs the control from the page state.
func (*ActiveLink) DrawingAttributes ¶ added in v0.21.0
func (l *ActiveLink) DrawingAttributes(ctx context.Context) html5tag.Attributes
DrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.
func (*ActiveLink) Init ¶ added in v0.21.0
func (l *ActiveLink) Init(parent page.ControlI, id string)
Init is called by subclasses of ActiveLink to initialize the link control structure.
func (*ActiveLink) IsActive ¶ added in v0.21.0
func (l *ActiveLink) IsActive() bool
IsActive returns whether the link is active or not.
func (*ActiveLink) Serialize ¶ added in v0.21.0
func (l *ActiveLink) Serialize(e page.Encoder)
Serialize serializes the state of the control for the pagestate
func (*ActiveLink) SetIsActive ¶ added in v0.21.0
func (l *ActiveLink) SetIsActive(isActive bool) ActiveLinkI
SetIsActive sets the active state of the control. When active, the ActiveAttributes will be merged into the tags other HTML attributes.
type ActiveLinkCreator ¶ added in v0.21.0
type ActiveLinkCreator struct { // ID is the control id. Leave blank to have one automatically assigned. ID string // Text is the text displayed inside the link. Text string // Location is the destination of the link (the href attribute). Location string // Download indicates that the "download" attribute should be assigned to the link. // Set to true to use the text of the link as the name of the file. Otherwise set to a string // to indicate the name of the file. Download any // ActiveAttributes are the attributes merged in to the current attributes to show that the link is active. // Matching attributes will be overridden for the most part, but the class attribute will be merged. ActiveAttributes html5tag.Attributes // ControlOptions are additional options for the html control. page.ControlOptions }
ActiveLinkCreator is the initialization structure for declarative creation of links
func (ActiveLinkCreator) Create ¶ added in v0.21.0
Create is called by the framework to create a new control from the Creator. You do not normally need to call this.
func (ActiveLinkCreator) Init ¶ added in v0.21.0
func (c ActiveLinkCreator) Init(ctx context.Context, ctrl ActiveLinkI)
Init is called by implementations of ActiveLinks to initialize a control with the creator. You do not normally need to call this.
type ActiveLinkI ¶ added in v0.21.0
type ActiveLinkI interface { LinkI IsActive() bool SetIsActive(bool) ActiveLinkI ActiveAttributes() html5tag.Attributes }
type Canvas ¶
type Canvas struct {
page.ControlBase
}
Canvas is a GoRADD control that is an HTML canvas control. It currently does not have any primitives to draw on the canvas, and is here primarily to create a canvas that you would draw on using JavaScript.
func GetCanvas ¶ added in v0.2.0
GetCanvas is a convenience method to return the canvas with the given id from the page.
func (*Canvas) DrawingAttributes ¶
func (c *Canvas) DrawingAttributes(ctx context.Context) html5tag.Attributes
DrawingAttributes is called by the framework to get the temporary attributes that are specifically set by this control just before drawing.
type CanvasCreator ¶ added in v0.2.0
type CanvasCreator struct { // ID is the control id ID string page.ControlOptions }
CanvasCreator is the initialization structure for declarative creation of buttons
type DataBinder ¶ added in v0.3.0
type DataBinder interface { // A DataBinder must be a control so that we can serialize it ID() string // BindData is called by the data manager to get the data for the control during draw time BindData(ctx context.Context, s DataManagerI) }
type DataManager ¶ added in v0.3.0
type DataManager struct {
// contains filtered or unexported fields
}
DataManager is an object designed to be embedded in a control that will help manage the data binding process.
func (*DataManager) Deserialize ¶ added in v0.3.0
func (d *DataManager) Deserialize(dec page.Decoder)
func (*DataManager) HasData ¶ added in v0.3.0
func (d *DataManager) HasData() bool
func (*DataManager) HasDataProvider ¶ added in v0.3.0
func (d *DataManager) HasDataProvider() bool
func (*DataManager) LoadData ¶ added in v0.3.0
func (d *DataManager) LoadData(ctx context.Context, owner DataManagerI)
LoadData tells the data binder to load data by calling SetData on the given object. The object should be the embedder of the DataManager
func (*DataManager) RangeData ¶ added in v0.3.0
func (d *DataManager) RangeData(f func(int, interface{}) bool)
RangeData will call the given function for each item in the data. The function should return true to continue, and false to end early.
func (*DataManager) ResetData ¶ added in v0.3.0
func (d *DataManager) ResetData()
ResetData is called by controls that use a data binder to unload the data after it is used.
func (*DataManager) Serialize ¶ added in v0.3.0
func (d *DataManager) Serialize(e page.Encoder)
func (*DataManager) SetData ¶ added in v0.3.0
func (d *DataManager) SetData(data interface{})
Call SetData to set the data of a control that uses a data binder. You MUST call it with a slice of some kind of data.
func (*DataManager) SetDataProvider ¶ added in v0.3.0
func (d *DataManager) SetDataProvider(b DataBinder)
func (*DataManager) SetDataWithOffset ¶ added in v0.13.7
func (d *DataManager) SetDataWithOffset(data interface{}, offset int)
Use SetDataWithOffset with controls that show a window onto a bigger data set.
offset is the first row number that is represented by the data.
type DataManagerI ¶ added in v0.3.0
type DataManagerI interface { page.ControlI SetDataProvider(b DataBinder) HasDataProvider() bool // SetData should be passed a slice of data items SetData(data interface{}) SetDataWithOffset(data interface{}, offset int) LoadData(ctx context.Context, owner DataManagerI) ResetData() }
A DataManagerI is the interface for the owner (the embedder) of the DataManager
type DataPager ¶
type DataPager struct { page.ControlBase ObjectName string ObjectPluralName string LabelForNext string LabelForPrevious string // contains filtered or unexported fields }
DataPager is a toolbar designed to aid scrolling a large set of data. It is implemented using Aria design best practices. It is designed to be paired with a Table or DataRepeater to aid in navigating through the data. It is similar to a Paginator, but a paginator is for navigating through a series of related web pages and not just for data on one form.
func NewDataPager ¶
func NewDataPager(parent page.ControlI, id string, pagedControl PagedControlI) *DataPager
NewDataPager creates a new DataPager
func (*DataPager) ButtonProxy ¶ added in v0.2.0
func (*DataPager) CalcBunch ¶
CalcBunch is called by the framework to lay out the data pager based on the number of pages in the pager. It should try to represent an easy to navigate interface that can manage 2 or 2000 pages.
A "Bunch" is defined as the collection of numbers that lies in between the pair of Ellipsis ("...")
Layout ¶
For an IndexCount of 10 2 213 2 (two items to the left of the bunch, and then 2 indexes, selected index, 3 indexes, and then two items to the right of the bunch) e.g. 1 ... 5 6 *7* 8 9 10 ... 100
For IndexCount of 11 2 313 2
For IndexCount of 12 2 314 2
For IndexCount of 13 2 414 2
For IndexCount of 14 2 415 2
Start/end page numbers for the bunch
For IndexCount of 10 1 2 3 4 5 6 7 8 .. 100 1 .. 4 5 *6* 7 8 9 .. 100 1 .. 92 93 *94* 95 96 97 .. 100 1 .. 93 94 95 96 97 98 99 100
For IndexCount of 11 1 2 3 4 5 6 7 8 9 .. 100 1 .. 4 5 6 *7* 8 9 10 .. 100 1 .. 91 92 93 *94* 95 96 97 .. 100 1 .. 92 93 94 95 96 97 98 99 100
For IndexCount of 12 1 2 3 4 5 6 7 8 9 10 .. 100 1 .. 4 5 6 *7* 8 9 10 11 .. 100 1 .. 90 91 92 *93* 94 95 96 97 .. 100 1 .. 91 92 93 94 95 96 97 98 99 100
For IndexCount of 13 1 2 3 4 5 6 7 8 9 11 .. 100 1 .. 4 5 6 7 *8* 9 10 11 12 .. 100 1 .. 89 90 91 92 *93* 94 95 96 97 .. 100 1 .. 90 91 92 93 94 95 96 97 98 99 100
Note: there are likely better ways to do this. Some innovative ones are to have groups of 10s, and then 100s etc. Or, use the ellipsis as a dropdown menu for more selections
func (*DataPager) Deserialize ¶
func (*DataPager) DoAction ¶ added in v0.23.0
Action is called by the framework to respond to actions.
func (*DataPager) DrawInnerHtml ¶
DrawInnerHtml is called by the framework to draw the control's inner html.
func (*DataPager) DrawPreRender ¶ added in v0.23.0
PreRender is called by the framework to load data into the paged control just before drawing.
func (*DataPager) DrawingAttributes ¶
func (d *DataPager) DrawingAttributes(ctx context.Context) html5tag.Attributes
DrawingAttributes is called by the framework to add temporary attributes to the html.
func (*DataPager) Init ¶
func (d *DataPager) Init(parent page.ControlI, id string, pagedControl PagedControlI)
Init is called by subclasses of a DataPager to initialize the data pager. You do not normally need to call this.
func (*DataPager) MarshalState ¶
func (d *DataPager) MarshalState(m page.SavedState)
MarshalState is an internal function to save the state of the control
func (*DataPager) NextButtonsHtml ¶
NextButtonsHtml returns the html for the next buttons. Subclasses can override this to change how the next buttons are drawn.
func (*DataPager) PageButtonsHtml ¶
PageButtonsHtml returns the html for the page buttons. Subclasses can override this to change how the page buttons are drawn.
func (*DataPager) PagedControl ¶ added in v0.2.0
func (d *DataPager) PagedControl() PagedControlI
func (*DataPager) PreviousButtonsHtml ¶
PreviousButtonsHtml returns the html to draw the previous buttons. Subclasses can override this to change how the Previous buttons are drawn.
func (*DataPager) SetMaxPageButtons ¶
SetMaxPageButtons sets the maximum number of buttons that will be displayed in the paginator.
func (*DataPager) SetObjectNames ¶
SetObjectNames sets the single and plural names of the objects that are represented in the data pager.
func (*DataPager) UnmarshalState ¶
func (d *DataPager) UnmarshalState(m page.SavedState)
UnmarshalState is an internal function to restore the state of the control
type DataPagerCreator ¶ added in v0.2.0
type DataPagerCreator struct { // ID is the control id ID string // MaxPageButtons is the maximum number of page buttons to display in the pager MaxPageButtons int // ObjectName is the name of the object being displayed in the table ObjectName string // ObjectPluralName is the plural name of the object being displayed ObjectPluralName string // LabelForNext is the text to use in the Next button LabelForNext string // LabelForPrevious is the text to use in the Previous button LabelForPrevious string // PagedControl is the id of the control that will be paged by the pager PagedControl string page.ControlOptions }
DataPagerCreator is the initialization structure for declarative creation of data pagers
func (DataPagerCreator) Create ¶ added in v0.2.0
Create is called by the framework to create a new control from the Creator. You do not normally need to call this.
func (DataPagerCreator) Init ¶ added in v0.2.0
func (c DataPagerCreator) Init(ctx context.Context, ctrl DataPagerI)
Init is called by implementations of Buttons to initialize a control with the creator. You do not normally need to call this.
type DataPagerI ¶
type DataPagerI interface { page.ControlI PreviousButtonsHtml() string NextButtonsHtml() string PageButtonsHtml(i int) string SetMaxPageButtons(b int) SetObjectNames(singular string, plural string) SetLabels(previous string, next string) }
DataPagerI is the data pager interface that allows this object to call into subclasses.
func GetDataPager ¶ added in v0.2.0
func GetDataPager(c page.ControlI, id string) DataPagerI
type DateTimeSpan ¶
type DateTimeSpan struct { Span // contains filtered or unexported fields }
DateTimeSpan is a span that displays a datetime value as static text. This is a typical default control to use for a timestamp in the database.
func NewDateTimeSpan ¶
func NewDateTimeSpan(parent page.ControlI, id string) *DateTimeSpan
NewDateTimeSpan create a new DateTimeSpan.
func (*DateTimeSpan) DateTime ¶ added in v0.9.3
func (s *DateTimeSpan) DateTime() time.Time
func (*DateTimeSpan) Deserialize ¶ added in v0.3.0
func (s *DateTimeSpan) Deserialize(dec page.Decoder)
func (*DateTimeSpan) DrawInnerHtml ¶
func (s *DateTimeSpan) DrawInnerHtml(_ context.Context, w io.Writer)
DrawInnerHtml is called by the framework to draw the inner html of the span.
func (*DateTimeSpan) DrawingAttributes ¶ added in v0.7.1
func (s *DateTimeSpan) DrawingAttributes(ctx context.Context) html5tag.Attributes
func (*DateTimeSpan) Init ¶
func (s *DateTimeSpan) Init(parent page.ControlI, id string)
Init is called by subclasses to initialize the parent. You do not normally need to call this.
func (*DateTimeSpan) Serialize ¶ added in v0.3.0
func (s *DateTimeSpan) Serialize(e page.Encoder)
func (*DateTimeSpan) SetDateTime ¶
func (s *DateTimeSpan) SetDateTime(d time.Time)
SetDateTime sets the value to a datetime.DateTime.
func (*DateTimeSpan) SetFormat ¶
func (s *DateTimeSpan) SetFormat(format string) *DateTimeSpan
SetFormat sets the format string. This should be a time.TimeFormat string described at https://golang.org/pkg/time/#Time.Format
func (*DateTimeSpan) SetValue ¶
func (s *DateTimeSpan) SetValue(v interface{})
SetValue sets the value display. You can set the value to a datetime.DateTime, a time.Time, or a string that can be parsed by the format string.
func (*DateTimeSpan) Value ¶
func (s *DateTimeSpan) Value() interface{}
Value returns the value as a datetime.DateTime object. Also satisfies the Valuer interface
type DateTimeSpanCreator ¶ added in v0.2.0
type Fieldset ¶
type Fieldset struct {
Panel
}
Fieldset is a Panel that is drawn with a fieldset tag. The panel's text is used as the legend tag. Fieldset controls cannot have wrappers.
func GetFieldset ¶ added in v0.2.0
GetFieldset is a convenience method to return the panel with the given id from the page.
func NewFieldset ¶
NewFieldset creates a new Fieldset.
func (*Fieldset) DrawingAttributes ¶
func (c *Fieldset) DrawingAttributes(ctx context.Context) html5tag.Attributes
DrawingAttributes is called by the framework.
type FieldsetCreator ¶ added in v0.2.0
type FieldsetCreator struct { // ID is the id the tag will have on the page and must be unique on the page ID string // Legend is the text to use in the legend tag of the fieldset Legend string // Children are the child creators declaring the controls wrapped by the fieldset Children []page.Creator page.ControlOptions }
FieldsetCreator declares a Fieldset control. Pass it to AddControls or as a child of other creators.
type FormBase ¶
The FormBase is the control that all Form objects should include, and is the master container for all other goradd controls. This is here for future expansion.
type FormFieldWrapper ¶ added in v0.2.0
type FormFieldWrapper struct { page.ControlBase // contains filtered or unexported fields }
FormFieldWrapper is a GoRADD control that wraps other controls, and provides common companion functionality like a form label, validation state display, and help text.
func GetFormFieldWrapper ¶ added in v0.2.0
func GetFormFieldWrapper(c page.ControlI, id string) *FormFieldWrapper
GetFormFieldWrapper is a convenience method to return the form field with the given id from the page.
func NewFormField ¶ added in v0.2.0
func NewFormField(parent page.ControlI, id string) *FormFieldWrapper
func (*FormFieldWrapper) ChildValidationChanged ¶ added in v0.2.5
func (c *FormFieldWrapper) ChildValidationChanged()
func (*FormFieldWrapper) Deserialize ¶ added in v0.3.0
func (c *FormFieldWrapper) Deserialize(dec page.Decoder)
func (*FormFieldWrapper) DrawTag ¶ added in v0.4.0
func (c *FormFieldWrapper) DrawTag(ctx context.Context, w io.Writer)
func (*FormFieldWrapper) DrawingAttributes ¶ added in v0.4.0
func (c *FormFieldWrapper) DrawingAttributes(ctx context.Context) html5tag.Attributes
func (*FormFieldWrapper) ErrorAttributes ¶ added in v0.2.0
func (c *FormFieldWrapper) ErrorAttributes() html5tag.Attributes
func (*FormFieldWrapper) For ¶ added in v0.2.0
func (c *FormFieldWrapper) For() string
func (*FormFieldWrapper) Init ¶ added in v0.2.0
func (c *FormFieldWrapper) Init(parent page.ControlI, id string)
func (*FormFieldWrapper) InstructionAttributes ¶ added in v0.2.0
func (c *FormFieldWrapper) InstructionAttributes() html5tag.Attributes
func (*FormFieldWrapper) Instructions ¶ added in v0.2.0
func (c *FormFieldWrapper) Instructions() string
Instructions returns the instructions to be printed with the control
func (*FormFieldWrapper) LabelAttributes ¶ added in v0.2.0
func (c *FormFieldWrapper) LabelAttributes() html5tag.Attributes
func (*FormFieldWrapper) Serialize ¶ added in v0.3.0
func (c *FormFieldWrapper) Serialize(e page.Encoder)
func (*FormFieldWrapper) SetErrorAttributes ¶ added in v0.2.0
func (c *FormFieldWrapper) SetErrorAttributes(a html5tag.Attributes) FormFieldWrapperI
func (*FormFieldWrapper) SetFor ¶ added in v0.2.0
func (c *FormFieldWrapper) SetFor(relatedId string) FormFieldWrapperI
SetFor associates the form field with a sub control. The relatedId is the ID that the form field is associated with. Most browsers allow you to click on the label in order to give focus to the related control
func (*FormFieldWrapper) SetInstructionAttributes ¶ added in v0.2.0
func (c *FormFieldWrapper) SetInstructionAttributes(a html5tag.Attributes) FormFieldWrapperI
func (*FormFieldWrapper) SetInstructions ¶ added in v0.2.0
func (c *FormFieldWrapper) SetInstructions(i string) FormFieldWrapperI
SetInstructions sets the instructions that will be printed with the control. Instructions only get rendered by wrappers, so if there is no wrapper, or the wrapper does not render the instructions, this will not appear.
func (*FormFieldWrapper) SetLabelAttributes ¶ added in v0.2.0
func (c *FormFieldWrapper) SetLabelAttributes(a html5tag.Attributes) FormFieldWrapperI
func (*FormFieldWrapper) SubTag ¶ added in v0.9.3
func (c *FormFieldWrapper) SubTag() string
type FormFieldWrapperCreator ¶ added in v0.2.0
type FormFieldWrapperCreator struct { // ID is the optional control id on the html form. If you do not specify this, it // will create on for you that is the ID of the child control + "-ff" ID string // Label is the text that will be in the html label tag associated with the Child control. Label string // Child is the creator of the child control you want to wrap Child page.Creator // Instructions offer help text that will follow the control and that further describes its purpose or use. Instructions string // For specifies the id of the control that the label is for, and that is the control that we are wrapping. // You normally do not need this, as it will simply look at the first child control, but if for some reason // that control is wrapped, you should explicitly specify the For control id here. For string // LabelAttributes are additional attributes to add to the label tag. LabelAttributes html5tag.Attributes // ErrorAttributes are additional attributes to add to the tag that displays the error. ErrorAttributes html5tag.Attributes // InstructionAttributes are additional attributes to add to the tag that displays the instructions. InstructionAttributes html5tag.Attributes // Set IsInline to true to use a "span" instead of a "div" in the wrapping tag. IsInline bool // ControlOptions are additional options for the wrapper tag ControlOptions page.ControlOptions }
FormFieldWrapperCreator creates a FormFieldWrapper, which wraps a control with a div or span that also has a label, validation error text and optional instructions. Pass the creator of the control you are wrapping as the Child item.
func (FormFieldWrapperCreator) Create ¶ added in v0.2.0
Create is called by the framework to create the control. You do not normally need to call it directly. Instead, either pass this creator to AddControls for the parent control you want to add this to, or add this to the Children of the parent control's creator.
func (FormFieldWrapperCreator) Init ¶ added in v0.2.0
func (f FormFieldWrapperCreator) Init(ctx context.Context, c FormFieldWrapperI)
Init is called by implementations of a FormFieldWrapper to initialize the creator. You do not normally need to call this.
type FormFieldWrapperI ¶ added in v0.2.0
type FormFieldWrapperI interface { page.ControlI SetFor(relatedId string) FormFieldWrapperI For() string Instructions() string SetInstructions(string) FormFieldWrapperI LabelAttributes() html5tag.Attributes ErrorAttributes() html5tag.Attributes InstructionAttributes() html5tag.Attributes }
type GridLayoutBuilder ¶ added in v0.0.3
type GridLayoutBuilder struct {
// contains filtered or unexported fields
}
GridLayoutBuilder is a helper that will allow a slice of items to be layed out in a table like pattern. It will compute the number of rows required, and then wrap the rows in row html, and the cells in cell html. You can have the items flow with the rows, or flow across the row axis. You can use this to build a table or a table-like structure.
This is largely obsoleted by CSS Grid.
func (*GridLayoutBuilder) Build ¶ added in v0.0.3
func (g *GridLayoutBuilder) Build() string
func (*GridLayoutBuilder) ColumnCount ¶ added in v0.0.3
func (g *GridLayoutBuilder) ColumnCount(count int) *GridLayoutBuilder
ColumnCount sets the number of columns.
func (*GridLayoutBuilder) Direction ¶ added in v0.0.3
func (g *GridLayoutBuilder) Direction(placement LayoutDirection) *GridLayoutBuilder
LayoutDirection indicates how items are placed, whether they should fill up rows first, or fill up columns.
func (*GridLayoutBuilder) Items ¶ added in v0.0.3
func (g *GridLayoutBuilder) Items(items []string) *GridLayoutBuilder
Items sets the html for each item to display.
func (*GridLayoutBuilder) RowClass ¶ added in v0.0.3
func (g *GridLayoutBuilder) RowClass(t string) *GridLayoutBuilder
func (*GridLayoutBuilder) RowTag ¶ added in v0.0.3
func (g *GridLayoutBuilder) RowTag(t string) *GridLayoutBuilder
type Image ¶
type Image struct { page.ControlBase // contains filtered or unexported fields }
Image is an img tag. You can display either a URL, or direct image information by setting the Src or the Data values.
func GetImage ¶ added in v0.2.0
GetImage is a convenience method to return the button with the given id from the page.
func (*Image) Deserialize ¶ added in v0.3.0
func (*Image) DrawingAttributes ¶
func (i *Image) DrawingAttributes(ctx context.Context) html5tag.Attributes
DrawingAttributes is called by the framework.
func (*Image) SetAlt ¶
SetAlt will set the alt tag. The html standard requires the alt tag. Alt tags are used to display a descirption of an image when the browser cannot display an image, and is very important for assistive technologies.
func (*Image) SetMimeType ¶
Set the MIME type for the data, (jpeg, gif, png, etc.)
type ImageCapture ¶
ImageCapture is a panel that has both an image and button to help you capture images from the user's camera. It is a kind of composite control that exports the image so that you can further manipulate it after creation. It also has javascript to manage the actual image capture process. It does not currently allow the user to upload an image in place of capturing an image from the camera. It only captures images from devices and browsers that support image capture.
func GetImageCapture ¶ added in v0.2.0
func GetImageCapture(c page.ControlI, id string) *ImageCapture
GetImageCapture is a convenience method to return the button with the given id from the page.
func NewImageCapture ¶
func NewImageCapture(parent page.ControlI, id string) *ImageCapture
NewImageCapture creates a new image capture panel.
func (*ImageCapture) Data ¶
func (i *ImageCapture) Data() []byte
func (*ImageCapture) Deserialize ¶ added in v0.3.0
func (i *ImageCapture) Deserialize(dec page.Decoder)
func (*ImageCapture) DrawingAttributes ¶
func (i *ImageCapture) DrawingAttributes(ctx context.Context) html5tag.Attributes
DrawingAttributes is called by the framework.
func (*ImageCapture) Init ¶
func (i *ImageCapture) Init(parent page.ControlI, id string)
Init is called by subclasses.
func (*ImageCapture) MarshalState ¶ added in v0.13.3
func (i *ImageCapture) MarshalState(m page.SavedState)
MarshalState is an internal function to save the state of the control
func (*ImageCapture) Serialize ¶ added in v0.3.0
func (i *ImageCapture) Serialize(e page.Encoder)
func (*ImageCapture) SetData ¶
func (i *ImageCapture) SetData(data []byte)
SetData sets the binary picture data. The data must be in the mime type format.
func (*ImageCapture) SetMaskShape ¶
func (i *ImageCapture) SetMaskShape(shape ImageCaptureShape)
SetMaskShape sets the masking shape for the image
func (*ImageCapture) SetMimeType ¶
func (i *ImageCapture) SetMimeType(typ string)
func (*ImageCapture) SetPixelSize ¶
func (i *ImageCapture) SetPixelSize(width int, height int)
SetPixelSize sets the pixel size of the image that will be returned. ControlBase the visible size of the canvas through setting css sizes.
func (*ImageCapture) SetQuality ¶
func (i *ImageCapture) SetQuality(quality float32)
SetQuality specifies a number between 0 and 1 used as the quality value for capturing jpegs or webp images.
func (*ImageCapture) SetZoom ¶
func (i *ImageCapture) SetZoom(zoom int)
SetZoom zooms the camera by the given percent, i.e. 50 is 50% closer and 100 would be a 2x zoom.
func (*ImageCapture) TurnOff ¶
func (i *ImageCapture) TurnOff()
TurnOff will turn off the camera and the image displayed in the control
func (*ImageCapture) UnmarshalState ¶ added in v0.13.3
func (i *ImageCapture) UnmarshalState(m page.SavedState)
UnmarshalState is an internal function to restore the state of the control
func (*ImageCapture) UpdateFormValues ¶
func (i *ImageCapture) UpdateFormValues(ctx context.Context)
UpdateFormValues is called by the framework.
type ImageCaptureCreator ¶ added in v0.2.0
type ImageCaptureCreator struct { // ID is the control id ID string MaskShape ImageCaptureShape MimeType string Zoom int Quality float32 SaveState bool page.ControlOptions }
ImageCaptureCreator is the initialization structure for declarative creation of buttons
type ImageCaptureI ¶
type ImageCaptureShape ¶
type ImageCaptureShape string
const ( ImageCaptureShapeRect ImageCaptureShape = "rect" ImageCaptureShapeCircle ImageCaptureShape = "circle" )
type ImageCreator ¶ added in v0.2.0
type ImageCreator struct { // ID is the control id ID string // Src is the content of the source attribute, usually a url Src string // Alt is the text displayed for screen readers Alt string MimeType string Width int Height int Data []byte page.ControlOptions }
ImageCreator is the initialization structure for declarative creation of buttons
type LabelAttributer ¶ added in v0.13.8
type LabelAttributer interface {
LabelAttributes() html5tag.Attributes
}
type LayoutDirection ¶ added in v0.0.4
type LayoutDirection int
LayoutDirection controls whether items are layed out in rows or columns.
const ( // LayoutRow lays out items in rows LayoutRow LayoutDirection = iota // LayoutColumn lays out items in columns, computing the number of rows required to make the specified number of columns. LayoutColumn )
type Link ¶ added in v0.17.0
type Link struct {
page.ControlBase
}
Link is a standard html link. It corresponds to an <a> tag in html.
func GetLink ¶ added in v0.17.0
GetLink is a convenience method to return the link with the given id from the page.
func (*Link) DrawingAttributes ¶ added in v0.17.0
func (l *Link) DrawingAttributes(ctx context.Context) html5tag.Attributes
DrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.
func (*Link) Init ¶ added in v0.17.0
Init is called by subclasses of Link to initialize the link control structure.
func (*Link) SetDownload ¶ added in v0.17.0
SetDownload sets the download attribute of the link.
When a user clicks on the link, the browser will cause the destination to be downloaded. Pass a value to name the download file, or pass the empty string to cause the browser to use the link name as the file name.
func (*Link) SetLocation ¶ added in v0.17.0
SetLocation sets the href attribute of the link
type LinkCreator ¶ added in v0.17.0
type LinkCreator struct { // ID is the control id. Leave blank to have one automatically assigned. ID string // Text is the text displayed inside the link. Text string // Location is the destination of the link (the href attribute). Location string // Download indicates that the "download" attribute should be assigned to the link. // Set to true to use the text of the link as the name of the file. Otherwise set to a string // to indicate the name of the file. Download any // ControlOptions are additional options for the html control. page.ControlOptions }
LinkCreator is the initialization structure for declarative creation of links
type PagedControl ¶ added in v0.2.0
type PagedControl struct {
// contains filtered or unexported fields
}
PagedControl is a mixin that makes a ControlBase controllable by a data pager. All embedders of a PagedControl MUST implement the Serialize and Deserialize methods so that the ControlBase versions of these functions will get called.
func (*PagedControl) AddDataPager ¶ added in v0.2.0
func (c *PagedControl) AddDataPager(d DataPagerI)
AddDataPager adds a data pager to the PagedControl. A PagedControl can have multiple data pagers.
func (*PagedControl) CalcPageCount ¶ added in v0.2.0
func (c *PagedControl) CalcPageCount() int
CalcPageCount will return the number of pages based on the page size and total items.
func (*PagedControl) Deserialize ¶ added in v0.3.0
func (c *PagedControl) Deserialize(dec page.Decoder)
func (*PagedControl) GetDataPagerIDs ¶ added in v0.2.0
func (c *PagedControl) GetDataPagerIDs() []string
func (*PagedControl) HasDataPagers ¶ added in v0.2.0
func (c *PagedControl) HasDataPagers() bool
func (*PagedControl) MarshalState ¶ added in v0.12.0
func (c *PagedControl) MarshalState(m page.SavedState)
MarshalState is an internal function to save the state of the control
func (*PagedControl) PageNum ¶ added in v0.2.0
func (c *PagedControl) PageNum() int
PageNum returns the current page number.
func (*PagedControl) PageSize ¶ added in v0.2.0
func (c *PagedControl) PageSize() int
PageSize returns the maximum number of items that will be allowed in a page.
func (*PagedControl) Serialize ¶ added in v0.3.0
func (c *PagedControl) Serialize(e page.Encoder)
Serialize encodes the PagedControl data for serialization. Note that all control implementations that use a PagedControl MUST create their own Serialize method, call the base ControlBase's version first, and then call this Serialize method.
func (*PagedControl) SetPageNum ¶ added in v0.2.0
func (c *PagedControl) SetPageNum(n int)
SetPageNum sets the current page number. It does not redraw anything, nor does it determine if the page is actually visible.
func (*PagedControl) SetPageSize ¶ added in v0.2.0
func (c *PagedControl) SetPageSize(size int)
SetPageSize sets the maximum number of items that will be displayed at one time. If more than this number of items is being displayed, the pager will allow paging to other items.
func (*PagedControl) SetTotalItems ¶ added in v0.2.0
func (c *PagedControl) SetTotalItems(count uint)
SetTotalItems sets the total number of items that the paginator keeps track of. This will be divided by the PageSize to determine the number of pages presented. You must call this each time the data size might change.
func (*PagedControl) SliceOffsets ¶ added in v0.2.0
func (c *PagedControl) SliceOffsets() (start, end int)
SliceOffsets returns the start and end values to use to specify a portion of a slice corresponding to the data the pager refers to
func (*PagedControl) SqlLimits ¶ added in v0.2.0
func (c *PagedControl) SqlLimits() (maxRowCount, offset int)
SqlLimits returns the limits you would use in a sql database limit clause
func (*PagedControl) TotalItems ¶ added in v0.2.0
func (c *PagedControl) TotalItems() int
TotalItems returns the number of items that the paginator is aware of in the list it is managing.
func (*PagedControl) UnmarshalState ¶ added in v0.12.0
func (c *PagedControl) UnmarshalState(m page.SavedState)
UnmarshalState is an internal function to restore the state of the control
type PagedControlI ¶ added in v0.2.0
type PagedControlI interface { DataManagerI SetTotalItems(uint) TotalItems() int SetPageSize(size int) PageSize() int PageNum() int SetPageNum(n int) AddDataPager(DataPagerI) CalcPageCount() int HasDataPagers() bool GetDataPagerIDs() []string SliceOffsets() (start, end int) }
PagedControlI is the interface that paged controls must implement
type Panel ¶
type Panel struct {
page.ControlBase
}
Panel is a GoRADD control that is a basic "div" wrapper.
Panel can be used for any kind of HTML tag by simply changing the Tag attribute. For example,
panel.Tag = "nav"
Turns a panel into a "nav" tag.
Customize how the tag is drawn by calling functions inherited from ControlBase. With these, you can set the class, data attributes, or any attribute. Call SetText() to set a string that will be drawn inside the div tag. Call SetTextIsHtml() to tell the control to treat the text as HTML and not escape it.
One typical use for a Panel is as a container for custom HTML and child controls. Child controls assigned to the Panel will automatically be drawn by default in the order they were assigned.
To customize this behavior, embed a Panel into your own custom struct, and then define the DrawInnerHtml() function on your struct. The framework will automatically call that function. Or, use a template to create the DrawTemplate function on your struct and the framework will use that instead. Examples can be found in the tutorial, in the bootstrap package, and in the code-generated panels.
func GetPanel ¶ added in v0.2.0
GetPanel is a convenience method to return the panel with the given id from the page.
func (*Panel) DrawingAttributes ¶
func (c *Panel) DrawingAttributes(ctx context.Context) html5tag.Attributes
type PanelCreator ¶ added in v0.2.0
type PanelCreator struct { // ID is the id the tag will have on the page and must be unique on the page ID string // Text is text that will become the innerhtml part of the tag Text string // If you set TextIsHtml, the Text will not be escaped prior to drawing TextIsHtml bool // Children is a list of creators to use to create the child controls of the panel. // You can wrap your child creators with the Children() function as a helper. Children []page.Creator page.ControlOptions }
PanelCreator creates a div control with child controls. Pass it to AddControls or as a child of a parent control.
type Proxy ¶
type Proxy struct {
page.ControlBase
}
Proxy is a control that attaches events to controls. It is useful for attaching similar events to a series of controls, like all the links in a table, or all the buttons in button bar. You can also use it to draw a series of links or buttons. The proxy differentiates between the different objects that are sending it events by the ActionValue that you gave the proxy.
To use a Proxy, create it in the control that wraps the controls the proxy will manage. Attach an event to the proxy control, and in the action handler, look for the ControlValue in the DoAction Value to know which of the controls sent the event. Draw the proxy with one of the following:
LinkHtml() - Output the proxy as a link ButtonHtml() - Output the proxy as a button TagHtml() - Output the proxy in any tag ActionAttributes() - Returns attributes you can use in any custom control to attach a proxy
The ProxyColumn of the Table object will use a proxy to draw items in a table column.
func GetProxy ¶ added in v0.2.0
GetProxy is a convenience method to return the button with the given id from the page.
func NewProxy ¶
NewProxy creates a new proxy. The parent must be the wrapping control of the objects that the proxy will manage.
func (*Proxy) ActionAttributes ¶
func (p *Proxy) ActionAttributes(actionValue string) html5tag.Attributes
ActionAttributes returns attributes that can be included in any tag to attach a proxy to the tag.
func (*Proxy) ButtonHtml ¶
func (p *Proxy) ButtonHtml(label string, actionValue string, attributes html5tag.Attributes, labelIsHtml bool, ) string
ButtonHtml outputs the proxy as a button tag. actionValue becomes the event's ControlValue parameter
func (*Proxy) Draw ¶
Draw is used by the form engine to draw the control. As a proxy, there is no html to draw, but this is where the scripts attached to the proxy get sent to the response. This should get drawn by the auto-drawing routine, since proxies are not rendered in templates.
func (*Proxy) LinkHtml ¶
func (p *Proxy) LinkHtml(ctx context.Context, label string, actionValue string, attributes html5tag.Attributes, ) string
LinkHtml renders the proxy as a link. To conform to the html standard and accessibility guidelines, links should only be used to navigate away from the page, so the action of your proxy should lead to that kind of behavior. Otherwise, use ButtonHtml.
func (*Proxy) OnSubmit ¶
OnSubmit is a shortcut for adding a click event handler that is particular to buttons. It debounces the click, to prevent potential accidental multiple form submissions. All events fired after this event fires will be lost. It is intended to be used when the action will result in navigating to a new page.
type ProxyCreator ¶ added in v0.2.0
type ProxyCreator struct { // ID is the id of the proxy. Proxies do not draw, so this id will not show up in the html, but you can // use it to get the proxy from the page. ID string // On is a shortcut to assign a single action to an event. If you want a proxy that responds to more than // one event or action, use On in the ControlOptions struct On On page.ControlOptions }
type ProxyI ¶
type ProxyI interface { page.ControlI LinkHtml(label string, actionValue string, attributes html5tag.Attributes, ) string TagHtml(label string, actionValue string, attributes html5tag.Attributes, tag string, rawHtml bool, ) string ButtonHtml(label string, eventActionValue string, attributes html5tag.Attributes, rawHtml bool, ) string OnSubmit(action action.ActionI) *event.Event }
type Repeater ¶ added in v0.2.3
type Repeater struct { page.ControlBase PagedControl DataManager // contains filtered or unexported fields }
Repeater is an HTML control that draws repeating child items.
Repeater is similar to a table, but more general purpose. Instead of drawing inside a table tag and using columns for formatting, it draws inside a div tag (which you can change by setting the Tag value), and repeats any kind of child item.
Like a table, the child items can be based on content taken from a DataBinder. You can also limit the amount of data displayed at one time by calling DataPager() and assigning a pager control.
func GetRepeater ¶ added in v0.2.3
GetRepeater is a convenience method to return the repeater with the given id from the page.
func NewRepeater ¶ added in v0.2.3
NewRepeater creates a new Repeater
func (*Repeater) Deserialize ¶ added in v0.3.0
func (*Repeater) DrawInnerHtml ¶ added in v0.4.0
DrawInnerHtml is an override to draw the individual items of the repeater.
func (*Repeater) DrawTag ¶ added in v0.4.0
DrawTag is called by the framework to draw the tag. The Repeater overrides this to call into the DataProvider to load the table's data into memory just before drawing. The data will be unloaded after drawing.
func (*Repeater) DrawingAttributes ¶ added in v0.4.0
func (r *Repeater) DrawingAttributes(ctx context.Context) html5tag.Attributes
DrawingAttributes is an override to add attributes to the table, including not showing the table at all if there is no data to show. This will hide header and footer cells and potentially the outline of the table when there is no data in the table.
func (*Repeater) Init ¶ added in v0.2.3
Init is an internal function that enables the object-oriented pattern of calling virtual functions used by the goradd controls.
func (*Repeater) MarshalState ¶ added in v0.12.0
func (r *Repeater) MarshalState(m page.SavedState)
MarshalState is an internal function to save the state of the control
func (*Repeater) SetItemHtmler ¶ added in v0.2.3
func (r *Repeater) SetItemHtmler(h RepeaterHtmler) RepeaterI
SetItemHtmler sets the htmler that provides the html for each item in the repeater.
func (*Repeater) UnmarshalState ¶ added in v0.12.0
func (r *Repeater) UnmarshalState(m page.SavedState)
UnmarshalState is an internal function to restore the state of the control
type RepeaterCreator ¶ added in v0.2.3
type RepeaterCreator struct { // ID is the control id ID string // ItemHtmler is the object that provides the html for each item ItemHtmler RepeaterHtmler // DataProvider is the data binder for the table. It can be either a control id or a DataBinder DataProvider DataBinder // DataProviderID is the control id of the data binder for the table. DataProviderID string // Data is the actual data for the table, and should be a slice of objects Data interface{} page.ControlOptions // PageSize is the number of rows to include in a page PageSize int // SaveState will cause the table to remember what page it was on SaveState bool }
RepeaterCreator creates a control that can be paged.
type RepeaterHtmler ¶ added in v0.2.3
type RepeaterI ¶ added in v0.2.3
type RepeaterI interface { PagedControlI DrawItem(ctx context.Context, i int, data interface{}, w io.Writer) SetItemHtmler(h RepeaterHtmler) RepeaterI }
type Span ¶
type Span struct {
Panel
}
Span is a Goradd control that is a basic "span" wrapper. Use it to style and listen to events on a span. It can also be used as the basis for more advanced javascript controls.
func GetSpan ¶ added in v0.2.1
GetSpan is a convenience method to return the button with the given id from the page.
func (*Span) DrawingAttributes ¶
func (c *Span) DrawingAttributes(ctx context.Context) html5tag.Attributes
type SpanCreator ¶ added in v0.2.0
type SpanCreator struct { // ID is the HTML id of the tag. ID string // Text is the content inside the span tag. Text string // TextIsHtml specifies that the content is HTML and should not be escaped. TextIsHtml bool // Children are child controls of the span. Children []page.Creator // ControlOptions are standard options you can set on any GoRADD control. page.ControlOptions }
SpanCreator creates a "span" tag.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package button includes button and button-like controls that are clickable, including things that toggle.
|
Package button includes button and button-like controls that are clickable, including things that toggle. |
Package dialog contains dialog controls.
|
Package dialog contains dialog controls. |
Package generator contains helper objects to describe controls to the code generator so that they can generate customizable data connectors that associate controls with data in the database.
|
Package generator contains helper objects to describe controls to the code generator so that they can generate customizable data connectors that associate controls with data in the database. |
Package list contains list-type controls.
|
Package list contains list-type controls. |
Package table implements various table controls.
|
Package table implements various table controls. |
Package textbox implements textbox-like form controls.
|
Package textbox implements textbox-like form controls. |