Exemple #1
0
func (f *Field) SetTmpl(tmpl string, style ...string) FieldInterface {
	f.tmpl = tmpl
	if f.tmpl != "" && f.Widget != nil {
		var s string
		if len(style) > 0 {
			s = style[0]
		} else {
			s = f.tmplStyle
		}
		f.Widget = widgets.BaseWidget(s, f.fieldType, f.tmpl)
	}
	return f
}
Exemple #2
0
// SetStyle sets the style (e.g.: BASE, BOOTSTRAP) of the field, correctly populating the Widget field.
func (f *Field) SetStyle(style string) FieldInterface {
	f.tmplStyle = style
	f.Widget = widgets.BaseWidget(style, f.fieldType, f.tmpl)
	return f
}