Work with Checkboxes

Documents for the development of and with JVx.

Work with Checkboxes

Postby Development@SIB » Tue Apr 08, 2014 1:29 pm

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);
User avatar
Development@SIB
 
Posts: 311
Joined: Mon Sep 28, 2009 1:54 pm

Return to Documentation