-
Notifications
You must be signed in to change notification settings - Fork 6
/
table_select.tpl.go
executable file
·166 lines (135 loc) · 3.46 KB
/
table_select.tpl.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
//** This file was code generated by GoT. DO NOT EDIT. ***
package panels
import (
"context"
"io"
)
// DrawTemplate draws the content of the matching control's template file.
func (ctrl *TableSelectPanel) DrawTemplate(ctx context.Context, _w io.Writer) (err error) {
if _, err = io.WriteString(_w, `<style>
#table2_scroller {
border: 1px solid gray;
overflow-x: hidden;
overflow-y: scroll;
height: 200px;
width: 50%;
margin-bottom: 20px;
scroll-behavior: smooth;
}
</style>
<h2>Tables - Selectable Rows</h2>
<p>
The SelectTable is a table that is used to select an item from a list of items. It uses css and javascript to demonstrate
to the user that the table is selectable, and it will remember the selection and report back to the go code
through a RowSelected event when an item is selected, and what that item was.
</p>
`); err != nil {
return
}
if `` == "" {
if _, err = io.WriteString(_w, ` `); err != nil {
return
}
ctrl.Page().GetControl("table1").Draw(ctx, _w)
if _, err = io.WriteString(_w, `
`); err != nil {
return
}
} else {
if _, err = io.WriteString(_w, ` `); err != nil {
return
}
ctrl.Page().GetControl("table1").ProcessAttributeString(``).Draw(ctx, _w)
if _, err = io.WriteString(_w, `
`); err != nil {
return
}
}
if _, err = io.WriteString(_w, `<p>
The next example is a select table that is scrollable.
The SelectTable will show the selected item at startup, and when its javascript <i>showSelectedItem</i> function
is called, which you can do from a Javascript action.
Some things to try as a demonstration of its capabilities:
</p>
<ul>
<li>Select an item, scroll the table so the selected item is not showing, and then click the Show Selected Item button.</li>
<li>Select an item, scroll the table so the selected item is not showing, and then refresh the page.</li>
</ul>
<p>
In each case, you should see the table scrolled so that the item is visible.
</p>
`); err != nil {
return
}
if `` == "" {
if _, err = io.WriteString(_w, ` `); err != nil {
return
}
ctrl.Page().GetControl("table2").Draw(ctx, _w)
if _, err = io.WriteString(_w, `
`); err != nil {
return
}
} else {
if _, err = io.WriteString(_w, ` `); err != nil {
return
}
ctrl.Page().GetControl("table2").ProcessAttributeString(``).Draw(ctx, _w)
if _, err = io.WriteString(_w, `
`); err != nil {
return
}
}
if _, err = io.WriteString(_w, `
<div class="boxed" style="width:50%">
`); err != nil {
return
}
if `` == "" {
if _, err = io.WriteString(_w, ` `); err != nil {
return
}
ctrl.Page().GetControl("infoPanel").Draw(ctx, _w)
if _, err = io.WriteString(_w, `
`); err != nil {
return
}
} else {
if _, err = io.WriteString(_w, ` `); err != nil {
return
}
ctrl.Page().GetControl("infoPanel").ProcessAttributeString(``).Draw(ctx, _w)
if _, err = io.WriteString(_w, `
`); err != nil {
return
}
}
if _, err = io.WriteString(_w, `</div>
`); err != nil {
return
}
if `` == "" {
if _, err = io.WriteString(_w, ` `); err != nil {
return
}
ctrl.Page().GetControl("showButton").Draw(ctx, _w)
if _, err = io.WriteString(_w, `
`); err != nil {
return
}
} else {
if _, err = io.WriteString(_w, ` `); err != nil {
return
}
ctrl.Page().GetControl("showButton").ProcessAttributeString(``).Draw(ctx, _w)
if _, err = io.WriteString(_w, `
`); err != nil {
return
}
}
if _, err = io.WriteString(_w, `
`); err != nil {
return
}
return
}