-
Notifications
You must be signed in to change notification settings - Fork 2
/
Grids.lua
170 lines (148 loc) · 4.98 KB
/
Grids.lua
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
167
168
169
170
--
-- Methods related to filling grid controls
--
function clearTable(gridControl)
if (gridControl.MainView ~= nil) then
if (gridControl.PrimaryTable ~= nil) then
gridControl.PrimaryTable:Clear()
end
if (gridControl.MainView.Columns ~= nil) then
gridControl.MainView.Columns:Clear()
end
end
end
function noSearchResult(gridControl, msg)
LogDebug("No search results found, displaying message on grid")
-- Set the grid view options
local gridView = gridControl.MainView
gridView.Columns:Clear()
gridView.OptionsView.ShowIndicator = false
gridView.OptionsView.ShowGroupPanel = false
gridView.OptionsView.RowAutoHeight = true
gridView.OptionsView.ColumnAutoWidth = false
gridView.OptionsBehavior.AutoExpandAllGroups = true
gridView.OptionsBehavior.Editable = false
local gridColumn
gridColumn = gridView.Columns:Add()
gridColumn.Caption = msg
gridColumn.FieldName = "noSearchResult"
gridColumn.Name = "gcNoSearchResult"
-- arbitrarily long tab length to be sure the user does not see its end
gridColumn.Width = 5550
gridColumn.Visible = true
gridColumn.VisibleIndex = 0
gridColumn.OptionsColumn.ReadOnly = true
end
function fillItemTable(gridControl)
LogDebug("Initializing item grid control")
-- Set the grid view options
local gridView = gridControl.MainView
gridView.Columns:Clear()
gridView.OptionsView.ShowIndicator = false
gridView.OptionsView.ShowGroupPanel = false
gridView.OptionsView.RowAutoHeight = true
gridView.OptionsView.ColumnAutoWidth = false
gridView.OptionsBehavior.AutoExpandAllGroups = true
gridView.OptionsBehavior.Editable = false
local gridColumn
gridColumn = gridView.Columns:Add()
gridColumn.Caption = "Collection Title"
gridColumn.FieldName = "collectionTitle"
gridColumn.Name = "gcCollectionTitle"
gridColumn.Width = 150
gridColumn.Visible = true
gridColumn.VisibleIndex = 0
gridColumn.OptionsColumn.ReadOnly = true
local gridColumn
gridColumn = gridView.Columns:Add()
gridColumn.Caption = "Call Number"
gridColumn.FieldName = "callNumber"
gridColumn.Name = "gcCallNumber"
gridColumn.Width = 120
gridColumn.Visible = true
-- puting a minus index makes the column invisible, but the row values can still be accessed for the item import
gridColumn.VisibleIndex = 1
gridColumn.OptionsColumn.ReadOnly = true
local gridColumn
gridColumn = gridView.Columns:Add()
gridColumn.Caption = "Container"
gridColumn.FieldName = "enumeration"
gridColumn.Name = "gcEnumeration"
gridColumn.Width = 100
gridColumn.Visible = true
gridColumn.VisibleIndex = 2
gridColumn.OptionsColumn.ReadOnly = true
local gridColumn
gridColumn = gridView.Columns:Add()
gridColumn.Caption = "Barcode"
gridColumn.FieldName = "item_barcode"
gridColumn.Name = "gcItemBarcode"
gridColumn.Width = 70
gridColumn.Visible = true
gridColumn.VisibleIndex = 3
gridColumn.OptionsColumn.ReadOnly = true
local gridColumn
gridColumn = gridView.Columns:Add()
gridColumn.Caption = "Location"
gridColumn.FieldName = "location"
gridColumn.Name = "gcLocation"
gridColumn.Width = 200
gridColumn.Visible = true
gridColumn.VisibleIndex = 4
gridColumn.OptionsColumn.ReadOnly = true
local gridColumn
gridColumn = gridView.Columns:Add()
gridColumn.Caption = "Container Profile"
gridColumn.FieldName = "profile"
gridColumn.Name = "gcContainerProfile"
gridColumn.Width = 200
gridColumn.Visible = true
gridColumn.VisibleIndex = 5
gridColumn.OptionsColumn.ReadOnly = true
local gridColumn
gridColumn = gridView.Columns:Add()
gridColumn.Caption = "Series"
gridColumn.FieldName = "series"
gridColumn.Name = "gcSeries"
gridColumn.Width = 80
gridColumn.Visible = true
-- IMPORTANT: if Type/subLocation are added back to the addon, this or sublocation's index needs to be changed
gridColumn.VisibleIndex = 6
gridColumn.OptionsColumn.ReadOnly = true
local gridColumn
gridColumn = gridView.Columns:Add()
gridColumn.Caption = "Restricted"
gridColumn.FieldName = "restrictions"
gridColumn.Name = "gcRestrictions"
gridColumn.Width = 60
gridColumn.Visible = true
gridColumn.VisibleIndex = 7
gridColumn.OptionsColumn.ReadOnly = true
local gridColumn
gridColumn = gridView.Columns:Add()
gridColumn.Caption = "Record ID"
gridColumn.FieldName = "item_id"
gridColumn.Name = "gcItem_Id"
gridColumn.Width = 50
gridColumn.Visible = true
gridColumn.VisibleIndex = 8
gridColumn.OptionsColumn.ReadOnly = true
local gridColumn
gridColumn = gridView.Columns:Add()
gridColumn.Caption = "Repo"
gridColumn.FieldName = "repo_code"
gridColumn.Name = "gcRepo_code"
gridColumn.Width = 40
gridColumn.Visible = true
gridColumn.VisibleIndex = 9
gridColumn.OptionsColumn.ReadOnly = true
local gridColumn
gridColumn = gridView.Columns:Add()
gridColumn.Caption = "HiddenDocPath"
gridColumn.FieldName = "doc_path"
gridColumn.Name = "gcDoc_path"
gridColumn.Width = 0
gridColumn.Visible = true
gridColumn.VisibleIndex = -1 -- hids this grid.
gridColumn.OptionsColumn.ReadOnly = true
end