How to use OptionGroup with a SQLContainer

Hello everyone,

I’ve created a OptionGroup with a SQLContainer as its “ContainerDataSource”. However, I’m a little bit lost on how to use this.

This:

options.setContainerDataSource(someSQLContainer); Gives me a list with the items in the container. The caption of these items is the primary key in the SQLContainer.
Okay, now I want to bind the Checkbox to a property in the SQLContainer. Basically I want to commit the set checkboxes to a boolean column in the SQL table.
How should I do this?

In case you didn’t get it, here’s an example which might clearify a few things =):

SQL table:
| ID number (number) | Checked (boolean) |
| 0 | false |
| 1 | true |
| 2 | false |

options.setContainerDataSource(someSQLContainer); So I run this code snippet with the given SQL table as the datasource and want to get this output:


0
[ x ]
1

2

However, the user changes the OptionGroup to:

[ x ]
0

1

2

After he hits the save button I do a:

options.commit(); And the SQL table finally looks like this:

| ID number (number) | Checked (boolean) |
| 0 | true |
| 1 | false |
| 2 | false |

Thanks and regards,
OddDeer