cancel
Showing results for 
Search instead for 
Did you mean: 

Binding selected item key of a select to model property

Former Member
0 Kudos
105

I have a Select like this one:

    <Select

        type="IconOnly"

        icon="{

            path: 'myModel>baz',

            formatter: 'myFormatter'

        }">

        <core:ListItem

            key="foo"

            text="Foo"/>

        <core:ListItem

            key="bar"

            text="bar"/>

    </Select>


And a model "myModel" with a property "baz" that I want to bind the selected item key to. To be clearer, I want the property "baz" to contain "foo" or "bar", when the respective item has been selected.

I need a different icon to be shown when "foo" or "bar" is selected. Right now, if the model is changed properly, it works just fine. But the binding needs to work for that to work.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

In this case, it suffice to add a new property to the Select:

    <Select

        type="IconOnly"

        icon="{

            path: 'myModel>baz',

            formatter: 'myFormatter'

        }"

        selectedKey="myModel>baz">

        <core:ListItem

            key="foo"

            text="Foo"/>

        <core:ListItem

            key="bar"

            text="bar"/>

    </Select>


Thank Dennis and Kedar!

Answers (2)

Answers (2)

former_member182862
Active Contributor
0 Kudos

HI Ricardo

Here is an example

Sample

-D

kedarT
Active Contributor
0 Kudos