-
Notifications
You must be signed in to change notification settings - Fork 9
/
browse-ajax.prg
77 lines (47 loc) · 1.62 KB
/
browse-ajax.prg
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
// {% LoadHrb( 'lib/tweb/tweb.hrb' ) %}
#include {% TWebInclude() %}
function main()
LOCAL o, oCol, oBrw
LOCAL cHtml := ''
LOcAL oWeb
DEFINE WEB oWeb TITLE 'Test Browse' TABLES INIT
DEFINE FORM o ID 'demo'
HTML o INLINE '<h3>Test Browse II</h3><hr>'
INIT FORM o
ROWGROUP o
SEPARATOR o LABEL 'Customers - States'
SELECT oSelect ID 'state' LABEL 'States' PROMPT '', 'NY', 'IL', 'WY', 'NE', 'NK', 'MT' GRID 6 ONCHANGE 'LoadState()' OF o
ENDROW o
ROWGROUP o
DEFINE BROWSE oBrw ID 'ringo' HEIGHT 400 OF o
ADD oCol TO oBrw ID 'last' HEADER 'Last' ALIGN 'right'
ADD oCol TO oBrw ID 'first' HEADER 'First' SORT
ADD oCol TO oBrw ID 'street' HEADER 'Street' SORT
ADD oCol TO oBrw ID 'age' HEADER 'Age' WIDTH 70 ALIGN 'center' FORMATTER 'ageFormatter'
ENDROW o
HTML o
<script>
var oWnd
var oBrw = new TWebBrowse( 'ringo' )
function LoadState() {
oWnd = MsgLoading()
var cState = $('#state').val()
MsgServer( 'srv_browse.prg', cState, Post_LoadState )
}
function Post_LoadState( dat ){
oWnd.modal('hide');
oBrw.SetData( dat.rows )
}
function ageFormatter(value, row) {
if ( row.age > 50 )
return '<i class="fa fa-star"></i> ' + value
else
return '<img src="images/ball_green.png"> ' + value
}
$(document).ready(function () {
oBrw.Init()
})
</script>
ENDTEXT
END FORM o
retu nil