0

I'm developing by Openui5 a portal. My portal have 2 apps. I I have organized the code in folders:

root
  |
  |____app1
  |____app2

For example, in app1 directory I have some sub directory (misc, fragment, master, detail) and in detail folder I have a subfolder detail--->form.

To work, my project needs:

sap.ui.localResources("app1.misc");
sap.ui.localResources("app1.fragment");
sap.ui.localResources("app1.master");
sap.ui.localResources("app1.detail");
sap.ui.localResources("app1.detail.form");

I want write a function getPaths(dir)

var aPaths= getPaths("app1");
for( var i = 0; i < aPaths.length; i++) {
      var path=aPaths[i];
      sap.ui.localResources(path);
} 

How can I implement the function?

padibro
  • 1,324
  • 10
  • 56
  • 95
  • 1
    I'm just wondering if you're planning on responding to answers to a previous question you posted, e.g. http://stackoverflow.com/questions/25689127/how-can-i-remove-a-master-or-detail-page-from-splitapp – qmacro Sep 08 '14 at 11:35
  • See also this comment by Tim Gerlach http://stackoverflow.com/questions/24327875/how-to-handle-the-itempress-of-a-table/24361565#comment38447973_24327875 – qmacro Sep 08 '14 at 11:50
  • I agree with @qmacro. And in addition to that, please bear in mind "*[..] SO is not here to help individual users with their problems. It is here to create a useful repository of high quality questions and answers so that the entire programming community can benefit by being able to search through that repository of knowledge to solve their problems without needing to actually ask another person for help. SO happens to help users with their problems, when they are able to ask a question that happens to help SO accomplish it's actual goal.*" http://meta.stackoverflow.com/a/254065/3270057 – Qualiture Sep 08 '14 at 21:37

1 Answers1

3

you cannot do getPaths(dir) in client side javascript to get your server side file structure . These lines of codes are necessary.

localResources and jQuery.sap.registerModulePath is to register component resources. Another way is to use data-sap-ui-resourceroots tag.

<script
    id='sap-ui-bootstrap'
    type='text/javascript'
    src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
    data-sap-ui-xx-bindingSyntax="complex"
    data-sap-ui-theme='sap_bluecrystal'
    data-sap-ui-libs='sap.m'

    data-sap-ui-resourceroots='{
        "app1" : "./",
        "misc" : "./misc",
        "fragment" : "./fragment",
        "master" : "./master",
        "detail" : "./detail",
    }' >
</script>
Haojie
  • 5,665
  • 1
  • 15
  • 14