-
Notifications
You must be signed in to change notification settings - Fork 9
/
browse-edit-preedit.prg
76 lines (48 loc) · 2 KB
/
browse-edit-preedit.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
// {% LoadHrb( 'lib/tweb/tweb.hrb' ) %}
#include {% TWebInclude() %}
function main()
local o, oCol, oBrw
local aRows := {}
Aadd( aRows, { 'id' => 'A1', 'name' => 'Charly Aubia' , 'qty' => 12 } )
Aadd( aRows, { 'id' => 'A2', 'name' => 'Maria de la O', 'qty' => 7 } )
Aadd( aRows, { 'id' => 'A3', 'name' => 'John Kocinsky', 'qty' => 23 } )
Aadd( aRows, { 'id' => 'A4', 'name' => 'Anne Clark' , 'qty' =>100 } )
Aadd( aRows, { 'id' => 'A5', 'name' => 'Daniel Clark' , 'qty' => 0 } )
Aadd( aRows, { 'id' => 'A6', 'name' => 'Rod Steward' , 'qty' => 98 } )
Aadd( aRows, { 'id' => 'A7', 'name' => 'Ally McPerson', 'qty' => 72 } )
Aadd( aRows, { 'id' => 'A8', 'name' => 'Bruce Polest' , 'qty' => 13 } )
DEFINE WEB oWeb TITLE 'Browse - Edit' TABLES INIT
DEFINE FORM o
HTML o INLINE '<h3>Basic Browse - PreEdit</h3><hr>'
INIT FORM o
DIV o ID 'bar' CLASS 'btn-group'
BUTTON LABEL ' Edit' ICON '<i class="far fa-edit"></i>' ACTION 'Edit()' CLASS 'btn-secondary mybtnbar' GRID 0 OF o
ENDDIV o
DEFINE BROWSE oBrw ID 'ringo' MULTISELECT CLICKSELECT HEIGHT 400 ;
EDIT UNIQUEID 'id' TITLE '<i class="fas fa-recycle"></i> My ABM...' PREEDIT 'TestPreEdit' ;
TOOLBAR "bar" ;
SEARCH ;
OF o
oBrw:cLocale := 'es-ES'
ADD oCol TO oBrw ID 'id' HEADER 'Id.' ALIGN 'center'
ADD oCol TO oBrw ID 'name' HEADER 'Name' EDIT TYPE 'V'
ADD oCol TO oBrw ID 'qty' HEADER 'Total' EDIT TYPE 'N' ALIGN 'right' WIDTH 100
INIT BROWSE oBrw DATA aRows
HTML o
<script>
var oBrw = new TWebBrowse( 'ringo' )
function Edit() { oBrw.Edit() }
function TestPreEdit( oItemEdit, oItemBrw ) {
console.log( 'PreEdit oItemEdit', oItemEdit )
console.log( 'PreEdit oItemBrw', oItemBrw )
var nQty = parseInt( oItemEdit.qty )
if ( nQty > 100 ) {
MsgInfo( 'Max. 100', 'Check Console' )
return false
}
return true
}
</script>
ENDTEXT
END FORM o
retu nil