Results 1 to 3 of 3

Thread: CheckBoxGroup equivalent

  1. #1
    Sencha User
    Join Date
    Aug 2009
    Vote Rating

    Default CheckBoxGroup equivalent

    In GXT 2, I used CheckBoxGroup to group many CheckBoxes in one field and had a custom validator to check that at least of the checkboxes is checked.

    CheckBoxGroup is not in GXT 3, how do I do the same? I studied FieldLabel, AbstractValidator, CheckBox documents, but can't find a concrete example to help me put them together. Appreciated if anyone could point me in the right direction.

  2. #2
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Superior, CO
    Vote Rating


    Take a look at the ToggleGroup class. I think that's what you want.

  3. #3
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Vote Rating


    The one issue with the ToggleGroup is that it only has one active value at a time - a CheckBox group should really implement HasValue<List<T>>, where T is either CheckBox (or rather HasValue<Boolean>), or is some model object. In the latter case, each checkbox gets a model object mapped to it, probably added when the checkbox is added. Might look something like this:
    CheckBoxGroup<Person> group = ...
    group.add(new Person("Colin"), colinCheckbox);
    group.add(new Person("Darrell"), darrellCheckBox);

    Of course, now you need to draw those checkboxes somewhere, and you probably get the model objects from somewhere else too - maybe a ListStore? So maybe this should look more like a ComboBox - give it a ListStore<T> full of T objects, and a LabelProvider<T> so generate box labels for the checkboxes, but then how does it actually draw the checkboxes? All in a vertical stack? In a grid, from left to right, the top to bottom, or top to bottom, then left to right? Scrollbars if it gets too big?

    So the short answer is that it is hard to solve this in a definitive, one-size-fits-all manner. My expectation was that lots of people would ask for such a thing, with ideas of what they wanted, and we would flesh it out in a future release, but I think this is the first forum post on the topic. That led me to believe that this isn't a very common problem, or that people build their own solutions readily.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts