forked from tudor-malene/Easygrid
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGridConfig.groovy
More file actions
72 lines (53 loc) · 2.05 KB
/
GridConfig.groovy
File metadata and controls
72 lines (53 loc) · 2.05 KB
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
package org.grails.plugin.easygrid
import groovy.transform.Canonical
/**
* Defines the configuration for a grid
*
* @author <a href='mailto:tudor.malene@gmail.com'>Tudor Malene</a>
*/
@Canonical
class GridConfig extends AbstractDynamicConfig{
String id
// the columns
ListMapWrapper<ColumnConfig> columns = new ListMapWrapper<ColumnConfig>('name')
// datasource settings
String dataSourceType
Class dataSourceService // the datasource implementation
// UI implementation settings
String gridImpl
Class gridImplService // the UI service implementation
String gridRenderer // the UI template renderer
// export settings
ExportConfig export = new ExportConfig()
//security settings
def roles // list of roles, or map of tipe [oper:Role] in case you need to fine grain
Closure securityProvider // closure that enforces access control on the grid methods
// inline edit settings
Boolean inlineEdit // allow inline editing
Closure beforeSave // closure used to transform the incoming parameters in an object ready to be persisted
//closures called on inline editing - should return null on success or the errors
Closure saveRowClosure // closure used for saving a row
Closure updateRowClosure
Closure delRowClosure
// formatters - map of type of data & the format closure
Map<Class, Closure> formats
// autocomplete settings
AutocompleteConfig autocomplete
// global filter
Closure globalFilterClosure
// the filter form
FilterFormConfig filterForm
// lifecycle closures- called during the initialization phase - will receive the gridConfig
// useful for applying different rules
// useful for adding new columns, etc
Closure beforeApplyingColumnRules
Closure afterInitialization
//list of params that are passed to the grid for the Rows call
List<String> externalParams = []
GridConfig() {
}
@Override
public String toString() {
return "GridConfig{${id}}"
}
}