SAPUI5 views, accessing model item for Panel heade

2019-03-05 03:57发布

问题:

I have the following model.

categories [
1: {
    0:{}
    1:{}
    categoryDesc: "Production"
}

2: {
    0:{}
    1:{}
    2:{}
    categoryDesc: "Documentation    
}
]

And the following view..

<List id="idList" items="{view>/categories}">
                    <items>
                        <CustomListItem>
                            <Panel expandable="true" expanded="false" headerText="{categoryDesc}">
                                <content>

                                </content>
                            </Panel>
                        </CustomListItem>
                    </items>
                </List>

The Issue is, the correct number of panels are being displayed (2), but categoryDesc is not being displayed.

So "view/>categories" is picking up array element 1 and 2 fine, i just can't retrieve the categoryDesc.

Any ideas?

回答1:

since you are using a named model you should use

{view>categoryDesc}


标签: view sapui5