Page content in the embedded view not fully visible - sapui5

I am trying to build an app which has several views. The first view shows a list and a "create" button. Upon clicking the create button, a second view is shown.
I want to be able to embed a sub-view into this second view.
<mvc:View
controllerName="openui5.view.Framework"
xmlns="sap.m"
xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc">
<Page id="detailPage"
showNavButton="true"
navButtonPress=".onBack">
<Button id="saveButton"
text="Save"
type="Accept"
icon="sap-icon://save"
press=".onSave" />
<Button id="nextButton"
text="Next"
type="Accept"
icon="sap-icon://action"
press=".onNext" />
<mvc:XMLView viewName="openui5.view.BasicInformation" async="true" />
</Page>
</mvc:View>
The embedded view:
<mvc:View
controllerName="openui5.view.BasicInformation"
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc">
<Page id="page1">
<Button id="stuffButton"
text="Stuff"
type="Accept"
icon="sap-icon://save"
press=".onSave" />
</Page>
</mvc:View>
I can see the title of the sub-view but no button.
Am I not doing something "special" when trying to embed this sub-view?

we used also fragments for subviews and it worked fine, but i found it a bit cumbersume to put it in a jsfiddle..still it tried, see below. You should not need to have the view tag around your fragment. Your fragment should have the name xx.fragment.xml in your project and does not need a controller.
then you should be able to include it directly as as xml in your xml view
see also https://openui5.hana.ondemand.com/#docs/guide/2c677b574ea2486a8d5f5414d15e21c5.html

As said before, you could use Fragments which are good for "small portions" of content.
Other solution would be including a Shell component with an inner page to your View and then using routing mechanism so content of your "sub-view" would be loaded into this shell page:
On the main View:
<Shell id="shellContainer" appWidthLimited="false">
<App id="appContainer" backgroundOpacity="0"></App>
</Shell>
On manifest.json:
"targets": {...
"YourSubViewDestination": {
"viewType": "XML",
"viewName": "YourSubViewName",
"controlAggregation": "pages",
"controlId": "appContainer",
"parent": "YourMainViewDestination"
}
...}
On your create button action:
this.getOwnerComponent().getRouter().navTo("YourSubViewDestination", {});
You may need some help with routing: Routing navigation

Related

Scrolling Issue when Page placed within Page in SAPUI5

I have a requirement where I need to place an sap.m.Page within another sap.m.Page, which I am aware is not recommended. The issue I'm facing is that I'm trying to enable scrolling for only the outer page; but the scrolling does not dynamically increase as I expand content inside the inner page. There is a lot of vertical content inside the inner page and is not entirely visible since the scrolling does not increase along with the expanded panels.
Even this does not resolve my issue. Kindly assist.
SAPUI5 version: 1.38.37
Layout of the outer page:
<mvc:View ...>
<Page showHeader="false">
<content>
<IconTabBar>
<items>
<IconTabFilter>
<content>
<mvc:XMLView viewName="namespace.view.InnerView1" displayBlock="true"/>
</content>
</IconTabFilter>
<IconTabSeparator icon=""/>
.
//multiple IconTabFilters here
.
</items>
</IconTabBar>
</content>
</Page>
</mvc:View>
Layout of the inner page (InnerView1):
<mvc:View ...>
<Page showHeader="false" enableScrolling="false">
<content>
.
//multiple expandable/collapsible Panels here
.
</content>
<footer floatingFooter="false">
<Toolbar>
<ToolbarSpacer/>
.
//multiple Buttons here
.
</Toolbar>
</footer>
</Page>
</mvc:View>
The Panels in the inner page are initially collapsed but they are expandable. But if all Panels are expanded in the running app, then the last couple of Panels are not accessible with the scrolling. i.e. the scrollbar does not adjust as per the panels' height.
Try using:
enableScrolling="false" //for disabling
enableScrolling="true" //for enabling

How can a dialog determine the correct size for contained NavContainers?

I want to add a popup to my application that contains a NavContainer. I need this to switch between two different views within the popup later. Now the NavContainer seems to need a fixed value for height and width to display content. Otherwise the popup will only be displayed in the size of the header and footer line. I realized that I can fix the size, but that's not the sense of a responsive application.
My code looks like this without the fixed information:
<core:FragmentDefinition
xmlns="sap.m"
xmlns:core="sap.ui.core"
xmlns:l="sap.ui.layout"
xmlns:f="sap.ui.layout.form"
>
<Dialog id="genericDialog"
showHeader="false"
title="Detail View"
>
<NavContainer>
<Page id="page1">
<List items="{/avGenericSet}">
<CustomListItem class="sapUiResponsiveMargin">
<ObjectIdentifier title="{title}"/>
<Input value="{value}"/>
</CustomListItem>
</List>
</Page>
<Page id="page2">
<!-- ... -->
</Page>
</NavContainer>
<endButton>
<Button text="Close" press="closeGenericDialog"/>
</endButton>
</Dialog>
</core:FragmentDefinition>
The behavior can be observed in all popup types (Dialog, Popover, ResponsivePopover). Does any of you know a workaround or do I have to say goodbye to a "responsive" popup?
Try with contentHeight="100%" (and contentWidth if required) from the Dialog. Here is an example: https://embed.plnkr.co/7nimup1UMGsifeDQ?show=view/fragment/Dialog.fragment.xml,preview

SAP UI5 Application - Scrollbar issues

In SAP UI5 application, every table has its own scrollbar. There is one page level scrollbar as well. Problem is, to see all the rows of the table I have to use, both the scrollbars. For example, if I am scrolling the table, once it reaches the bottom (of the page not table), scroll disappears. Now to see remaining of the rows, I have to use Page scrollbar and move it down. Then again I can see table scroll and can move below. This means i have to use 2 scrollbars for viewing the rows. Any way to avoid this?
Second issue: If I don't use tag proper page level scroll does not appear. A very long scroll thumb appears (for example if I use semantic page tag as shown below, the scroll thumb is as good as body in length, with very little area to move as track)
ABC.xml
<mvc:View controllerName="com.ABC" xmlns:layout="sap.ui.layout" xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:semantic="sap.m.semantic">
//Here instead of semantic page if I use
// <Page class="sapUiNoMargin maxPage" showHeader="false"> it works fine
with proper page scroll of nice thumb length
<semantic:SemanticPage busy="{sharedApp>/oBusy/busy}" busyIndicatorDelay="{sharedApp/oBusy/delay}" id="page" showSubHeader="false">
<semantic:content>
<core:Fragment id="ordersGrowlNotifier" fragmentName="com.ASD" type="XML"/>
<IconTabBar id="order-tabs" select="onTabChangeEvent" expandable="false" class="tabs">
<items>
<IconTabFilter text="Order" key="cart_tab">
<content>
<VBox>
<items>
<core:Fragment fragmentName="com.Order" type="XML"/>
</items>
</VBox>
</content>
</IconTabFilter>
<IconTabFilter id="orderdetails-tab-track" key="track_tab" text="Track" visible="{orderMenu>/TrackVisible}" >
<content>
<VBox>
<items>
<core:Fragment fragmentName="com.XYZ" type="XML"/>
</items>
</VBox>
</content>
</IconTabFilter>
</items>
</IconTabBar>
</semantic:content>
</semantic:SemanticPage>
</mvc:View>

Fiori $expand with CRM data

I'm having some sort of rudimentary problem with navigation in my sapui5 fiori app. I'm just trying to navigate from Opportunities to Complex Notes, but it's not working at all. Here is a stripped down version of my simple view. There is no logic in any controller. As simple as I could imagine it. Because it's so simple I'm thinking I'm reading the odata wrong. So here is a link to that odata. I really appreciate it, I'm spinning my wheels on this one and I'm sure it's something ridiculous. Always is.
<mvc:View xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
controllerName="BlankDocumentToBeDeletedLater.controller.View1" displayBlock="true">
<App>
<pages>
<Page title="{i18n>title}">
<content>
<List noDataText="Drop list items here" id="__list0" items="{ path : '/Opportunities', parameters:{'$expand' : 'ComplexNotes'}}">
<items>
<CustomListItem>
<content>
<Title text="ID : {Guid}"></Title>
<List items="{ComplexNotes}">
<items>
<ObjectListItem title="whatevs" intro="{HeaderGuid}">
</ObjectListItem>
</items>
</List>
</content>
</CustomListItem>
</items>
</List>
</content>
</Page>
</pages>
</App>
“$” for expand is only needed on OData V4;
“/Opportunities” into the path for “listitems”;
text=”ID: {Guid}” won’t work, it needs a formatter to join the fixed text to the Guid property;
I've never seen a list in a list – the developer should try with the parent list first.
Check in the chrome network the request and response that is created by the UI5 binding.

Error While Creating a Dialog Box Using XML Fragments

I am getting the below error while trying to display a dialog box after user presses a button,
sap-ui-core.js:80 Uncaught Error: failed to load 'sap/m/buttons.js' from resources/sap/m/buttons.js: 404 - Resource could not be found!
Please find the XML code below.
<Dialog xmlns="sap.m"
icon="sap.icon://filter"
title="Filter product details">
<content>
<List id="ls2"
items="{/value}"
mode="MultiSelect">
<StandardListItem title="{CompanyName}"/>
</List>
</content>
<buttons>
<Button text="ok" icon="sap-icon://accept" press="handleok"/>
<Button text="Cancel" icon="sap.icon://cancel"/>
</buttons>
</Dialog>
So the issue was that the UI5 version was quite outdated after all. The aggregation buttons was introduced as of version 1.21.1.
You have to wrap the sap.m.Dialog control inside a FragmentDefinition according to the walkthrough guide.
Here is minimal example https://embed.plnkr.co/OjUCXTg2afohZyDvPp67/
<core:FragmentDefinition
xmlns="sap.m"
xmlns:core="sap.ui.core">
<Dialog
id="helloDialog"
title="Hello World">
<buttons>
<Button text="Ok">
<Button text="Cancel">
</buttons>
</Dialog>
</core:FragmentDefinition>
And instead of using a dialog control you can use a sap.m.MessageBox control which provides you with "Ok" and "Cancel" or custom buttons.