Q:

Using model for ID assignment

I tried to assign ID to items in my select control using model binding, but ended with an error. 
Here is my code:
Model:
{
    "languages": [
        {
        "language": "English",
        "locale": "en"
        }, 
        {
        "language": "German",
        "locale": "de"
        }
    ]
}

Select control:
var oLanguageSelection = new sap.m.Select({
            name:   'languageSelection',
            id:     'languageSelection',
            items: { 
                path: "languages>/languages",
                template: new sap.ui.core.Item({
                    id: "{languages>locale}", //this is the problematic part
                    text: "{languages>language}",
                }),

            },
});

Error I get:
Uncaught Error: "{languages>locale}" is not a valid ID.

Is it possible at all to do what I am trying to do - assign element ID using model binding?
Thank you.

A:

I think id is not bindable. ID refers to the control id that is also used in the DOM. What you are trying to do should be achieved with the key property :)
var oLanguageSelection = new sap.m.Select({
    name:   'languageSelection',
    id:     'languageSelection',
    selectedKey: "{languages>/languages/0/locale}", // you might want to set a default selection
    items: { 
        path: "languages>/languages",
        template: new sap.ui.core.Item({
            key: "{languages>locale}", // no longer problematic ;)
            text: "{languages>language}"
        })  
    }
});

