Checkbox in statis table

I have a static table that is setup in the construction script, not using simle values.

How do I set a column to be a checkbox?

The help text only says how to do it using simple values configuration. I'd like to do it through setFieldValue.

/ Peter

 

RE: Checkbox in statis table

setFieldValue("addHeader", Map().insert("header", "foo").insert("flags", "64"));

Sverre

Av: Sverre Hjelm 19. jan 2015

RE: Checkbox in statis table

Works, but how do I set the value of the cells...?

For 'normal' cells I do this:

grid.setFieldValue("addCell", Map().insert("label", value ));

But it doesn't work for the checkbox.

/ Peter

Av: Peter Borg 19. jan 2015

RE: Checkbox in statis table

This column will be identified as the one for selecting a column. You specify whether a column should be selected by specifying "selected" = "true" when adding a row.

foo.setFieldValue("addRow", Map().insert("selected", "true")...

Sverre

Av: Sverre Hjelm 22. jan 2015

RE: Checkbox in statis table

I see. I needed multiple checkboxes per row so I just gave up and printed an X for a true value and blank for false.

 

Thanks

 

Peter

Av: Peter Borg 25. jan 2015

RE: Checkbox in statis table

Ok. We actually do support multiple checkbox'es per row, using another method. Let me know if you are interested :)

Sverre

Av: Sverre Hjelm 26. jan 2015

RE: Checkbox in statis table

Hi Sverre - I'm interested :).

Av: Kasper Rosenlund 1. jul 2018

RE: Checkbox in statis table

Hi,

You can add columns and specify that they should contain a checkbox by setting header.x.checkBox = true. For instance like this:

headers.0.label = Id
headers.1.label = Title
headers.2.label = Category
headers.3.label = Posted
headers.4.label = Deadline
headers.5.label = Check1
headers.5.checkBox = true
headers.6.label = Check2
headers.6.checkBox = true
headers.length = 7
pageSize = 100

Then, when you add rows programatically, you can set the checkbox value by add a cell with label 0 or 1. E.g. like this:

tickets.setFieldValue("addRow", rowMap); // Row map is map of row options.
... standard columns
tickets.setFieldValue("addCell", Map("label=1"));
tickets.setFieldValue("addCell", Map("label=0"));

Sverre

Av: Sverre Hjelm 2. jul 2018

RE: Checkbox in statis table

Hi Sverre, thank you for your answer.

I managed to do something simular, after a couple of days without food and sleep ;).

Av: Kasper Rosenlund 24. jul 2018