Skip to Content
0

SAPUI5 views, accessing model item for Panel header

Oct 22, 2017 at 08:51 PM

51

avatar image

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?

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

2 Answers

Best Answer
Tri Minh Le Oct 22, 2017 at 11:05 PM
1

Hello Adam,

You could try to change header text path to headerText="{view>categoryDesc}".

Tri

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Perfect!

Thank you!

0
Irfan Gokak Oct 23, 2017 at 08:09 AM
0

Hi Adam,

if your JSON is like below

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

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

// use like below Code
 <Panel expandable="true" expanded="false" headerText="{view>/1/categoryDesc}">

// ==============================================================================
// Or else form your json in different way
Share
10 |10000 characters needed characters left characters exceeded