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... 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.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.