Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Auto Suggest, Empty picker list

    Hi all,

    I have implemented a ComboBoxItem which I can reuse as an auto suggest item...

    Code:
    package com.serengetisystems.tcrm.client.widgets;
    
    ... header stuff...
    
    public class AutoSuggestItem extends ComboBoxItem {
    
        public AutoSuggestItem(String name, String title) {
            super(name, title);
            setType("comboBox");
            setShowPickerIcon(false);
            setDisplayField(AutoSuggestValueDto.VALUE);
            setValueField(AutoSuggestValueDto.VALUE);
    
            setEmptyPickListMessage("No suggestions");
        }
    
    
    }
    And I'm using it like this...

    Code:
    private AutoSuggestItem postCode = new AutoSuggestItem("POST_CODE", DictionaryUtils.get(DictionaryConstants.POSTCODE));
    ...
    postCode.setOptionDataSource(AddressAutoSuggestDS.getInstance(AddressAutoSuggestDS.ADDRESS_AUTO_SUGGEST_TYPE.POST_CODE));
    It all works pretty well, the small issue I have it that if there's no matching criteria, then the options box is displayed displaying the text "No items to show". Now I changed that to "No suggestions" as you can see in my widgets code, however what I really want is for the box to not display at all if there are no options returned.

    In the showcase, the combobox example () works this way so I'm hopeful it can be achieved, the only difference I can see between mine and the showcase is that I use a datasource whereas the showcase hardcodes some values into a data map.

    What can I do to make it behave this way?, there's no setShowPickerListWhenEmpty(boolean) method or anything similar that I can see.

    Thanks,
    Dale

    #2
    That was me being stupid, just went through API one last time, and there it is...

    setHideEmptyPickList(true);

    Code:
    public class AutoSuggestItem extends ComboBoxItem {
    
        public AutoSuggestItem(String name, String title) {
            super(name, title);
            setType("comboBox");
            setShowPickerIcon(false);
            setCompleteOnTab(true);
            setHideEmptyPickList(true);
    
            setDisplayField(AutoSuggestValueDto.VALUE);
            setValueField(AutoSuggestValueDto.VALUE);
    
            //setEmptyPickListMessage("No matching suggestions");
        }
    
    }

    Comment

    Working...
    X