Skip to Content
avatar image
Former Member

sap.m.Select.setValueState and sap.m.Select.setEnabled is not working

I have a select list as below

<Select
        id="ComponentTypeSelectList"
        forceSelection="false"
        selectedKey="{CreateTest>component/componentType}"
        class="sapUiNoMargin"
        change="onComponentTypeSelection">
    <items>
        <core:Item key="Java" text="Java"/>
        <core:Item key="C_PLUS_PLUS" text="C++"/>
        <core:Item key="Node" text="Node"/>
        <core:Item key="UNKNOWN" text="Others"/>
    </items>
    <layoutData>
        <l:GridData span="L5 M5 S12" />
    </layoutData>
</Select>

I am trying to set the value state and toggle between enable and disable as below from my JS code

var oSelectList = this.getView().byId("ComponentTypeSelectList");

oSelectList.setEnabled(true);
oSelectList.setValueState("Success");

For some reason, it doesn't seem to work. Whereas when i try the settings in my XML view directly, it works.

Wondering where could this go wrong. Please help

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Apr 12, 2017 at 03:29 PM

    this should work, check this link : https://jsfiddle.net/Akhilesh_U/36cyvka9/

    try to find out the scenario when its not working, and share your suspected code.

    Add comment
    10|10000 characters needed characters exceeded