7
votes

I want to map a folder like structure to a list control in sap.m Master view.

Please have a look at thie demo app named Shopping Cart. You will see a Master->Master->Detail navigation. From Category to Products to (Product) Detail.

I already studied the source code. The navigation above is realized using routing.

For my projects, I would like to have something similar. However, it would be no simple M->M->D structure. My data would be received in JSON form from a SAP Enterprise Portal folder structure. Each folder can have other folders or files. The data structure could like like this, but may have n levels of folders:

{ "root": [
  { "name" : "Folder A",
  "isCollection": true,
  "content" : [
    { "name" : "Sub Folder A",
      "isCollection": true,
      "content" : [
        {"filename":"IpsumPrimisIn.xls","datatype":"application/vnd.ms-excel"},{"filename":"IdOrnare.mp3","datatype":"audio/x-mpeg-3"}
      ]
     }
    ]
  },
  { "name" : "Folder B",
    "isCollection": true,
    "content" : [
      { "name" : "Sub Folder B",
        "isCollection": true,
        "content" : [
          {"filename":"IpsumPrimisIn.xls","datatype":"application/vnd.ms-excel"}{"filename":"Non.mov","datatype":"video/quicktime"}
        ]
      }
    ]
  }
] }

Please note, that the folder structure will be changing and might become more diverse and more deep over the time.

An ideal solution would be to dynamicly read, adapt and map the JSON structure to some kind of SAPUI5 routing logic. Is this possible? Have a Router instance, loop through my JSON structure, call addRoute() on it and dynamicly add the folder as a route...

Note: I already know how to create a JSON structure based on SAP EP folders.

1
are we talking about n-levels in the JSON structure tree here?Sunil B N
Thank you, yes, exactly like that. I updated my question.SDD64

1 Answers

0
votes

This is my solution: Map json to menu in Openui5 It works fine!

Every time that i click on a menu item i call a controller function that open a detail page or create every time a new istance of the menu on a new master page.