Skip to Content
0

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

Apr 12, 2017 at 02:56 PM

63

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Akhilesh Upadhyay Apr 12, 2017 at 03:29 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded