Skip to Content
0
May 30, 2018 at 07:43 AM

SAPUI5: Problem Object Page with blocks

1574 Views

Dear experts,

I'm developing the Fiori App and want to display some subsections with custom blocks on the object page. I created the folde blocks in the project, created the block file MyBlock.js as following:

sap.ui.define(['sap/uxap/BlockBase'], function (BlockBase) { "use strict";

var MyBlock = BlockBase.extend("sap.uxap.sample.ObjectPageSubSection.IndustryBlock", { metadata: { views: { Collapsed: { viewName: "here is my namespace.view.MyView", type: "XML" }, Expanded: { viewName: "here is my namespace.view.MyView", , type: "XML" } } } }); return MyBlock; });

A added the view to the projects, with my own controls and added the block to the object page like this:

<sections> <!-- Any amount of sap.uxap.ObjectPageSection controls --> <ObjectPageSection> <!-- Any amount of sap.uxap.ObjectPageSubSection controls --> <ObjectPageSubSection id="objectPageSection1">

<blocks>

<blocks:MyBlock id="MyBlock"/>

</blocks>

</ObjectPageSubSection>

</ObjectPageSection> </sections>

And the syntax check of Web IDE says "unexpected namespace blocks".

I tried to enter the namespace of the project, but I get teh same error, and when I remove the namespace and write <MyBlock id="MyBlock"/> i get the erro in console (when I start my app):

Uncaught (in promise) Error: failed to load 'sap/uxap/MyBlock.js' from resources/sap/uxap/MyBlock.js: 404 - Not Found

what I'm doing wrong?

Thank you

Pavel