SmartGwt Select all option for Selectitem

1.4k views Asked by At

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.

1

There are 1 answers

0
Sharavanakumaar Murugesan On BEST ANSWER

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);