Announcement

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

    Disabling The some of the Dropdown items

    Hi,
    We are using SmartGWT 4-1 pro (Nightly Build :2014-07-09).
    We have a requirement like disabling some of the items in SelectItem.

    1. We have a Select Item.
    2. We have added a value map to Select Item.
    SelectItem sampleSelectItem = new SelectItem();
    LinkedHashMap<String, String> sampleMap = new LinkedHashMap<String, String>();
    sampleMap .put("itemKey1", "Item-A");
    sampleMap .put("itemKey2", "Item-B");
    sampleMap .put("itemKey3", "Item-C");
    sampleMap .put("itemKey4", "Item-D");

    sampleSelectItem.setValueMap(sampleMap);

    Our requirement is some of the Items has to be disabled, what I mean to say is, the user able to see the items but he can not select that disabled items from the Select Item.
    Here I want to disable "Item-A", "Item-B" on UI.
    Is there any API to disable the select items from user selection.
    Please give us a solution for this requirement.


    Thanks.

    #2
    Instead of supplying your options as a valueMap, you could create a clientOnly dataSource containing your options as records and set some of them to disabled as required.
    The SelectItem would then have its optionDataSource attribute set to point at this dataSource, and value / display field set up to show the key / values you want.

    Regards
    Isomorphic Software

    Comment

    Working...
    X