The grid is configured through the 'default value' of the custom field. This allows you to setup multiple types of grids.
Configuration is done by specifying properties for various items. The TGE - Documentation contains all details on these properties, but as an introduction we will work out the configuration for the family list grid, so that you get an idea of the capabilities of the plugin.
Columns
Every grid configuration starts by specifying what columns should be setup.
gd.columns=name, dob, gender, relation
- gd.columns is the property name
- name, dob, gender, relation are the columns.
These are actually the column id's used to specify the behavior for each column.
Setup a simple column containing the first name
col.name=First name col.name.type=string col.name.width = 40
- All the properties related to the 'name' column are prefixed with col.name
- First name is the column heading or label. You can change it any way you want.
- col.name.type is the type of the column, in this case 'string'
- col.name.width is the column's width in pixels
Setup a date column containing the date of birth.
col.dob=Date of Birth col.dob.type=date col.dob.width=30 col.dob.sortable=true
- All the properties related to the 'date of birth' column are prefix with col.dob
- col.dob.type=date indicates that the column will hold dates
- col.dob.width is the width of the column
- col.dob.sortable is a column property spefying that the user can sort on this column, by clicking on the header.
Setup a column containing 2 radio buttons (male / female) for the gender
col.gender=Gender col.gender.width=30 col.gender.editable=true col.gender.sortable=true col.gender.type=radio col.gender.list.size=2 col.gender.name1=Male col.gender.value1=M col.gender.name2=Female col.gender.value2=F
- The editable column property (col.gender.editable) allows you to indicate if a column should be writable (=true) or not (=false). The default value is 'true'.
- The type of the column is 'radio' (col.gender.type=radio).
- col.gender.list.size=2 indicates that there should be 2 radio buttons.
- col.gender.name1=Male is the label of the first radio button
- col.gender.value1=M is the value which will be stored in the database
- col.gender.name2=Female, col.gender.value2=F is the label and value for the second radio button.
Setup a column containing a static list for the role
col.relation=Role col.relation.width=30 col.relation.type=list col.relation.list.size=4 col.relation.name1=Father col.relation.value1=Dad col.relation.name2=Mother col.relation.value2=Mom col.relation.name3=Son col.relation.value3=S col.relation.name4=Daughter col.relation.value4=D
- The type of the column is list (col.relation.type = list)
- There are 4 values in the list (col.relation.list.size=4)
- The first name/value pair is Father/Dad (col.relation.name1/col.relation.value1)
- The second name/value pair is Mother/Mom (col.relation.name2/col.relation.value2)
- ...
Lists can be populated using a query - retrieving values from a database.
To be able to explain how this works, move to the next section .