Skip to Content

SAPUI5 views, accessing model item for Panel header

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Oct 22, 2017 at 11:05 PM

    Hello Adam,

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

    Tri

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 23, 2017 at 08:09 AM

    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
    Add comment
    10|10000 characters needed characters exceeded