Add Checkbox Type Feature To Grid Cells

Is it possible to add a checkbox type feature to grid cells? Some kind of multiple selection feature?

I am trying to create a grid where in each cell the user can select a combination of four different events (rather than creating four different grids - one for each).

I thought if it would be possible to add a button item (as used in showcase menus and such) then I could add that to each cell, and then when the button was clicked a menu would appear with various checkboxes. However, it doesn’t seem that this is an option when working with the Datasource. The closest I have seen is simply using the DataSourceTextField and using setValueMap() to create a combo box, but this only allows one option to be selected at a time.

See the Grid Custom Editor sample. You could do something like the following. Note the SelectItem.setMultiple(true) call.

    ListGridField nameField = new ListGridField("countryName", "Country", 220);

    SelectItem countrySelectItem = new SelectItem();
    countrySelectItem.setName("countryName");
    countrySelectItem.setPickListWidth(200);
    countrySelectItem.setMultiple(true);

    nameField.setValueMap(getCountryMap());
    nameField.setEditorType(countrySelectItem);

I tried out your suggestion, and while I think it works, it seems that something else is just as easy.

I had previously configured it to work as a combo box.

DataSourceTextField wed_field = new DataSourceTextField("wednesday","Wednesday");
		wed_field.setValueMap("TB","IR", "NP");
		ds.addField(wed_field);

The above code was done when creating the data source. It provides a combo box for the wed_field with the options TB, IR, and NP.

However, if I simply add

wed_field.setMultiple(true);

Then it becomes a box where I can select multiple items. However, it definitely doesn’t look as pretty since it is just a white box in it with selected items highlighted.

So I tried out your method from scratch, and the SelectItem method seems to have the same result. Should there be any difference?

One thing that makes me wonder is I did not notice any animation for the SelectItem list even though I had setAnimatePickList(true) and setAnimationTime(1000) set. So perhaps I did not create the SelectItem version correctly.

Either way, the two versions I had (trying through SelectItem or simply taking a combobox grid item as created in the showcase examples and calling DataSourceTextField.setMultiple(true)) did not seem very pretty unfortunately, although they would work.

Furthermore, it was not as user-friendly, as I had to control click or shift click to select multiple items, which isn’t as intuitive. I do not expect the users of this software to be very good with computers so having to mix in control clicks and shift clicks makes things more difficult (vs. a collection of checkboxes, where they just click the ones they want - but I have yet to figure out how to do this in a grid.)