We are at Atlassian Summit - which will affect our response times. Meet us there (if you happen to be in San Jose)

Page tree
Skip to end of metadata
Go to start of metadata

You can use the grid to retrieve data from a database.

For instance, assume you want to create a sandwich ordering functionality to complement your in-house event management system.

For each event you want to be able to indicate what sandwiches should be delivered - it should look something like this:

To setup such a grid you need:

a) A database containing a table with all the sandwich menu choices
b) The connection string to access the data.

We will use the same database as for the previous example, but it should be clear that the source data can be retrieved from any other database.
(The (mysql) sql statements to create the sandwich_menu source table is available in the sandwich_menu.sql )

Use the following grid configuration properties to populate the grid with data:

gd.query=select name,price from sandwich_menu
gd.query.ds=gridds
  • gd.query = select... contains the query to retrieve the data from the sandwich_menu
  • gd.query.ds = gridds declares the database where the data can be found.


The full recipe for this example.

  • Add a new custom table grid field and configure it with following configuration specification.
gd.columns=sandwich,price,aantal
gd.tablename=sandwich_order
gd.query=select name,price from sandwich_menu
gd.query.ds=gridds


datasource.names=gridds
ds.gridds.connection.type=mysql
ds.gridds.connection.url=jdbc:mysql://localhost:3306/igrid_test?useUnicode=true&characterEncoding=UTF8&jdbcCompliantTruncation=false
ds.gridds.connection.username=igrid_tester
ds.gridds.connection.password=igrid_tester

col.sandwich=Sandwich
col.sandwich.type=string
col.sandwich.editable=false
col.sandwich.width=200

col.price=Price
col.price.type=number
col.price.editable=false
col.price.width=75

col.aantal=Count
col.aantal.type=number
col.aantal.minvalue=0
col.aantal.maxvalue=10
col.aantal.width=75
  • gd.sandwich.editable = false  set the column with the sandwich names and prices to false. That way your user will not change it inadvertently.


Check initialization properties to get complete list of the properties used to initialize a grid.