-
Notifications
You must be signed in to change notification settings - Fork 1
/
uiselect.go
43 lines (35 loc) · 905 Bytes
/
uiselect.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package jaws
import (
"io"
"github.com/linkdata/jaws/what"
)
type UiSelect struct {
uiWrapContainer
}
func NewUiSelect(sh SelectHandler) *UiSelect {
return &UiSelect{
uiWrapContainer{
Container: sh,
},
}
}
func (ui *UiSelect) JawsRender(e *Element, w io.Writer, params []any) error {
return ui.renderContainer(e, w, "select", params)
}
func (ui *UiSelect) JawsUpdate(e *Element) {
e.SetValue(ui.uiWrapContainer.Container.(StringSetter).JawsGetString(e))
ui.uiWrapContainer.JawsUpdate(e)
}
func (ui *UiSelect) JawsEvent(e *Element, wht what.What, val string) (err error) {
if wht == what.Input {
err = ui.uiWrapContainer.Container.(StringSetter).JawsSetString(e, val)
e.Dirty(ui.Tag)
if err != nil {
return
}
}
return ui.UiHtml.JawsEvent(e, wht, val)
}
func (rq RequestWriter) Select(sh SelectHandler, params ...any) error {
return rq.UI(NewUiSelect(sh), params...)
}