Page 1 of 1

--Work with Checkboxes

PostPosted: Tue Apr 08, 2014 1:29 pm
by Development@SIB


This article is outdated - please use our new system at

https://doc.sibvisions.com




If you need native Checkboxes which are automatically bound to your model, instead of fake "ChoiceCellEditor checkboxes", you can use UICheckBoxCellEditor.

But be aware that such native checkboxes only have 2 states and 2 values (selected or unselected, e.g. Y or N). You can't set a custom value for null/empty. This would be possible with UIChoiceCellEditor.

The advantage of native checkboxes is that they will fit your Look and Feel. But this would be also possible with custom images and choice cell editors.

How to use the checkbox cell editor?

The syntax is similar to ChoiceCellEditors, e.g.

Syntax: [ Download ] [ Hide ]
rowDef.getColumnDefinition("CHOOSE").getDataType().
                                           setCellEditor(ApplicationUtil.YESNO_CHECKBOX);

The ApplicationUtil defines default cell editors. The YESNO_CHECKBOX is defined as:
Syntax: [ Download ] [ Hide ]
new UICheckBoxCellEditor("Y", "N");


It's also possible to define default checkbox cell editors for an application:
Syntax: [ Download ] [ Hide ]
UICheckBoxCellEditor.addDefaultCheckBoxCellEditor(ApplicationUtil.YESNO_CHECKBOX);