Press "Enter" to skip to content

K2: How to show checkboxes in a List View

0

As you may know, the Boolean field (aka Yes/No in Smartforms) is not rendered as a checkbox in list views. Instead, you usually see True/False. Below I will show, how you can display Yes/No columns as checkboxes in a list view.

1. Create a new SMO with the fields below. I created an SMO with the name Checkbox.Test.BoolOption.

image

2. Create association with the main SmartObject, where you store your data. You need to bind the Yes/No field, which you would like to display as a checkbox, to the ID property of the newly created SmartObject. This is needed, because in the final step you will have to use a ListDisplay control, and, unfortunately, K2 does not support converting existing controls to a ListDisplay one for a Yes/No columns, if they are not associated with another SmartObject.

image

3. After you created the SmartObject and configured associations, you need to create 2 new items in the Checkbox.Test.BoolOption SmartObject:

image

You can copy the html from here:

4. Create or Modify a list view, adding the Active field to the List View. K2 will automatically create a column with a ListDisplay control inside. You need to edit the properties of the control:

image

Afterwards, you can open your list view and see the results:

image

Leave a Reply

Your email address will not be published. Required fields are marked *

4 − three =