3

I would like to have select all option for a select item where multiple set as true. Can I place it like a button or by using some other components ?

I have tried by using some buttons but it doesn't looks good.

  • possible duplicate of http://stackoverflow.com/questions/19831660/smartgwt-select-all-functionality – pratZ Aug 13 '14 at 19:57
  • 1
    I need a separate icon /button to choose, because select item was grouped and have individual values. Eg :- Select item 1 & 2 are mapped with same values, if we select 1st value it must be removed from select item list 2.SO select all button select all the listed values in select item and those items must be removed from selectitem2 – Sharavanakumaar Murugesan Aug 14 '14 at 05:30

1 Answers1

3

This can be done by using Pickericon in SmartGWT. Use the code below

    select = new SelectItem("TEMP" + "SAMPLE");
    select.setMultiple(true);
    select.setMultipleAppearance(MultipleAppearance.PICKLIST);
    select.setTitleAlign(Alignment.LEFT);
    select.setShowFocused(false);
    select.setShowDisabled(false);
    select.setShowErrorStyle(false);

    select_all = new PickerIcon(new Picker("checked.png"),
            new FormItemClickHandler() {

                @Override
                public void onFormItemClick(FormItemIconClickEvent event) {
                    //CODE to set all item to
                }
            });
    select_all.setPrompt("Select all");

    clear_all = new PickerIcon(PickerIcon.CLEAR,
            new FormItemClickHandler() {

                @Override
                public void onFormItemClick(FormItemIconClickEvent event) {

                    select.clearValue();
                }
            });
    clear_all.setPrompt("Clear selection");

    select.setIcons(select_all);