07-04-2014 2:46 PM
Hi,
is it possible to bind the worksetitems of a Shell to a model?
All I've seen is the option to add single worksetitems via "addWorksetItem", but no option to load them from e.g. an XML file and bind them directly.
Thanks,
Oliver
07-09-2014 2:46 PM
Hi Oliver,
You can bind the aggregation wirksetitem like this:
....Shell({
...,
worksetItems: {
path: "/data",
template: new sap.ui.ux3.NavigationItem({
text: "{textPropOfModel}",
key: "{keyPropOfModel}"
})
}
})
Hope it helps.
Regards,
Jose Manuel
08-05-2014 9:01 AM
Hi Jose Manuel,
thanks for the code sample. I got it to work now for the Main Menu, but as soon as I bind a Sub Menu (which also works fine), I am not able to select MainMenu Items anymore, because the selected key always stays the key of the initally selected SubMenu Item.
My Model:
var NavigationList = [
{
"ID":2,
"MainMenuName":"MainMenuItem2",
"SubMenuItemList":[
{
"ID":4,
"SubMenuName":"SubMenuItem2-1",
"key_name":"sub2_1",
},
{
"ID":5,
"SubMenuName":"SubMenuItem2-2",
"key_name":"sub2_2",
}
]
},
{
"ID":3,
"MainMenuName":"MainMenuItem3",
"SubMenuItemList":[
{
"ID":8,
"SubMenuName":"SubMenuItem3-3",
"key_name":"sub3_3",
}
]
}
];
And my oShell code:
worksetItems: {
path: "/NavigationList",
template: new sap.ui.ux3.NavigationItem({
text: "{MainMenuName}",
key: "{ID}",
subItems: {
path: "/NavigationList/0/SubMenuItemList",
template: new sap.ui.ux3.NavigationItem({
text: "{SubMenuName}",
key: "{key_name}"
})
}
})
},
After initial bind, the Shell Workset items are fine, I can select the submenu items SubMenuItem2-1 and SubMenuItem2-2 correctly, but when I want to switch to another Main Menu Item, e.g. MainMenuItem3, the initial Sub Menu Item stays selected (SubMenuItem2-1). So it seems like the key of the MainMenu is being overwritten.
What am I doing wrong?
Thanks,
Oliver