Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Bind ux3.Shell Worksetitems to a Model?

0 Kudos

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

2 REPLIES 2

Former Member
0 Kudos

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

0 Kudos

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