How do I make the layouts in this view more responsive? - iphone

I am working on a UI5 app and I was wondering how do I change the view so it will work on a Iphone. Currently the app just renders one card in Iphone mode and the rest of the cards are cut off. I want the Iphone to load the cards in vertical order and on a big screen (laptop, desktop) horizontal order. I am using a grid layout and I tried changing the default span but that didn't do anything.
Here is my code
<mvc:View controllerName="ariba.cso.acwws.controller.WorkingWithSupport" xmlns:core="sap.ui.core" xmlns="sap.m"
xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" xmlns:f="sap.f" xmlns:l="sap.ui.layout" xmlns:card="sap.f.cards"
xmlns:csolib="ariba.cso.reuselibrary.controls">
<f:DynamicPage id="dynamicpage">
<f:title>
<f:DynamicPageTitle>
<f:heading>
<Title text="{i18n>pagetitle}"/>
</f:heading>
</f:DynamicPageTitle>
</f:title>
<f:content>
<VBox>
<l:Grid containerQuery="true" defaultSpan="S1">
<HBox>
<f:Card width="385px" class="sapUiLargeMargin">
<f:header>
<card:Header title="{i18n>highlight}"/>
</f:header>
<f:content>
<VBox>
<Text text="{text>/body}" class="sapUiSmallMargin"/>
<Link text="{text>/title}" press="hilightLink" class="sapUiTinyMargin"/>
</VBox>
</f:content>
</f:Card>
<f:Card width="340px" class="sapUiLargeMargin">
<f:header>
<card:Header title="{text>/csso}"/>
</f:header>
<f:content>
<VBox>
<Link text="{text>/wgl}" press="whatgolivelink" class="sapUiTinyMargin"/>
<Link text="{text>/ssi}" press="selfServiceLink" class="sapUiTinyMargin"/>
<Link text="{text>/ssrp}" press="regPortalLink" class="sapUiTinyMargin"/>
<Link text="{text>/acss}" press="overviewLink" class="sapUiTinyMargin"/>
<Link text="{text>/sas}" press="sourcingLink" class="sapUiTinyMargin"/>
</VBox>
</f:content>
</f:Card>
<f:Card width="400px" class="sapUiLargeMargin">
<f:header>
<card:Header title="{i18n>services}"/>
</f:header>
<f:content>
<VBox>
<Label text="{i18n>cloudsupportpolicy}" design="Bold" class="sapUiTinyMargin"/>
<Link text="{i18n>cloudsupportpolicylink}" press="cloudLink" class="sapUiTinyMargin" wrapping="true"/>
<Label text="{i18n>onpremisesupportpolicy}" design="Bold" class="sapUiTinyMargin"/>
<Link text="{text>/teops}" press="onPremiseLink" class="sapUiTinyMargin" wrapping="true"/>
<Label text="{i18n>previoussupportpolicy}" design="Bold" class="sapUiTinyMargin"/>
<Link text="{text>/ces}" press="prevSuppLinkA" class="sapUiTinyMargin" wrapping="true"/>
<Link text="{text>/tes}" press="prevSuppLinkB" class="sapUiTinyMargin" wrapping="true"/>
<Label text="{i18n>premiumsupportpolicy}" design="Bold" class="sapUiTinyMargin"/>
<Link text="{text>/ecsd}" press="premiumLink" class="sapUiTinyMargin" wrapping="true"/>
<Link text="{i18n>premiumsupportpolicylink}" press="premiumLink" class="sapUiTinyMargin" wrapping="true"/>
<Label text="{i18n>agreements}" design="Bold" class="sapUiTinyMargin"/>
<Link text="{i18n>agreementslink}" press="agreementLink" class="sapUiTinyMargin" wrapping="true"/>
<Label text="{i18n>lifecycle}" design="Bold" class="sapUiTinyMargin"/>
<Link text="{text>/plc}" press="lifeCycleLink" class="sapUiTinyMargin" wrapping="true"/>
<Label text="{i18n>programs}" design="Bold" class="sapUiTinyMargin"/>
<Link text="{text>/psn}" press="programLinkA" class="sapUiTinyMargin" wrapping="true"/>
<Link text="{text>/tcss}" press="programLinkB" class="sapUiTinyMargin" wrapping="true"/>
</VBox>
</f:content>
</f:Card>
</HBox>
</l:Grid>
<csolib:ACFooter/>
</VBox>
</f:content>
</f:DynamicPage>
</mvc:View>
The expected result is iphone or small screens the cards should load in vertical order and on big screens like laptop or desktop the cards should be horizontal.

As per your code you have used width and large margins for cards, which was not required. Also you have used HBox which will align the cards next to each other rather then responsive layout. Grid will take care of responsive padding/margin by itself and also modified the default span for responsiveness.
Updated code
<f:DynamicPage id="dynamicpage">
<f:title>
<f:DynamicPageTitle>
<f:heading>
<Title text="{i18n>pagetitle}"/>
</f:heading>
</f:DynamicPageTitle>
</f:title>
<f:content>
<VBox>
<l:Grid containerQuery="true" defaultSpan="XL2 L4" class="sapUiTinyMargin">
<f:Card>
<f:header>
<card:Header title="{i18n>highlight}"/>
</f:header>
<f:content>
<VBox>
<Text text="{text>/body}" class="sapUiSmallMargin"/>
<Link text="{text>/title}" press="hilightLink" class="sapUiTinyMargin"/>
</VBox>
</f:content>
</f:Card>
<f:Card>
<f:header>
<card:Header title="{text>/csso}"/>
</f:header>
<f:content>
<VBox>
<Link text="{text>/wgl}" press="whatgolivelink" class="sapUiTinyMargin"/>
<Link text="{text>/ssi}" press="selfServiceLink" class="sapUiTinyMargin"/>
<Link text="{text>/ssrp}" press="regPortalLink" class="sapUiTinyMargin"/>
<Link text="{text>/acss}" press="overviewLink" class="sapUiTinyMargin"/>
<Link text="{text>/sas}" press="sourcingLink" class="sapUiTinyMargin"/>
</VBox>
</f:content>
</f:Card>
<f:Card>
<f:header>
<card:Header title="{i18n>services}"/>
</f:header>
<f:content>
<VBox>
<Label text="{i18n>cloudsupportpolicy}" design="Bold" class="sapUiTinyMargin"/>
<Link text="{i18n>cloudsupportpolicylink}" press="cloudLink" class="sapUiTinyMargin" wrapping="true"/>
<Label text="{i18n>onpremisesupportpolicy}" design="Bold" class="sapUiTinyMargin"/>
<Link text="{text>/teops}" press="onPremiseLink" class="sapUiTinyMargin" wrapping="true"/>
<Label text="{i18n>previoussupportpolicy}" design="Bold" class="sapUiTinyMargin"/>
<Link text="{text>/ces}" press="prevSuppLinkA" class="sapUiTinyMargin" wrapping="true"/>
<Link text="{text>/tes}" press="prevSuppLinkB" class="sapUiTinyMargin" wrapping="true"/>
<Label text="{i18n>premiumsupportpolicy}" design="Bold" class="sapUiTinyMargin"/>
<Link text="{text>/ecsd}" press="premiumLink" class="sapUiTinyMargin" wrapping="true"/>
<Link text="{i18n>premiumsupportpolicylink}" press="premiumLink" class="sapUiTinyMargin" wrapping="true"/>
<Label text="{i18n>agreements}" design="Bold" class="sapUiTinyMargin"/>
<Link text="{i18n>agreementslink}" press="agreementLink" class="sapUiTinyMargin" wrapping="true"/>
<Label text="{i18n>lifecycle}" design="Bold" class="sapUiTinyMargin"/>
<Link text="{text>/plc}" press="lifeCycleLink" class="sapUiTinyMargin" wrapping="true"/>
<Label text="{i18n>programs}" design="Bold" class="sapUiTinyMargin"/>
<Link text="{text>/psn}" press="programLinkA" class="sapUiTinyMargin" wrapping="true"/>
<Link text="{text>/tcss}" press="programLinkB" class="sapUiTinyMargin" wrapping="true"/>
</VBox>
</f:content>
</f:Card>
</l:Grid>
<!-- <csolib:ACFooter/> -->
</VBox>
</f:content>
</f:DynamicPage>

Related

IconTabBar with stretchcontentheight makes my header disappear in SAPUI5

I have this issue where I want to have the scrollbar active only for the content of my IconTabBar, while keeping the header fixed. I read here in stackoverflow that I should put all the content inside a ScrollContainer, and then set the stretchContentHeight="true".
But this option kills my header.
this is my code
<mvc:View
controllerName="Quickstart.App"
displayBlock="true"
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc"
xmlns:l="sap.ui.layout"
xmlns:core="sap.ui.core"
xmlns:tnt="sap.tnt"
height="100%">
<App id="app">
<Page id="intro" showHeader="false" enableScrolling="false">
<tnt:ToolHeader height="10rem">
<Image src="./images/image.png"/>
<Text text="title" wrapping="false" />
<ToolbarSpacer />
<Button text="Feedback" icon="sap-icon://feedback" type="Transparent" press="onPressFeedback"/>
</tnt:ToolHeader>
<IconTabBar
id="idIconTabBarNoIcons"
items="{/Sheet1}"
class="sapUiResponsiveContentPadding"
expandable="false"
backgroundDesign="Transparent"
applyContentPadding="false"
stretchContentHeight="true">
<items>
<IconTabFilter text="{category_title}" key="info">
<Toolbar class="toolbar_boarder" design="Transparent">
<ToolbarSpacer/>
<Button text="Sort" tooltip="Order Alphabetically" id="IdSortButton" width="70px" press="onPressSort" icon="sap-icon://alphabetical-order" type="Ghost"/>
<Button id="IdExpandButton" tooltip="Additional Information" text="Collapse" class="sapUiTinyMarginEnd" width="101px" press="onPressExpand" icon="sap-icon://collapse-all" type="Ghost"/>
</Toolbar>
<ScrollContainer id="Scroll" class="sapUIBody" height="100%" width="100%" horizontal="false" vertical="true">
<l:Grid containerQuery="true" content="{path:'tools', templateShareable:false}" id="gridId">
<Panel class="iconFilters" fieldGroupIds="idPanel" >
<HBox>
<!-- <core:Icon press="onPressToolIcon"
src="{tool_icon_url}" size="2rem" color="Default" class="" /> -->
<Image src="{tool_icon_url}" width="2.2rem" press="onPressToolImage"></Image>
<Link text="{tool_title}" wrapping="true" target="_blank" href="{tool_redirect_url}" class="sapUiTinyMargin title_header"/>
</HBox>
<!-- Control the size of the line before badges -->
<Toolbar height="6px" width="75%"></Toolbar>
<HBox items="{path:'badges', templateShareable:false}" height="1rem" justifyContent="End" class="drawline">
<core:Icon size="1rem" src="{badge_css_url}" tooltip="{badge_hover_text}" class="badgePadding" />
</HBox>
<VBox height="11rem">
<Label text="Use Cases" class="sapUiTinyTop" design="Bold"/>
<List
items="{path:'usecases', templateShareable:false}"
includeItemInSelection="true">
<CustomListItem>
<HBox class="listItems">
<Text text="• " class="items_circle" />
<FormattedText htmlText="{item}" />
</HBox>
</CustomListItem>
</List>
</VBox>
<VBox height="11rem">
<Label text="Strengths" class="sapUiSmallTop" design="Bold"/>
<List
items="{path:'strengths', templateShareable:false}"
includeItemInSelection="true">
<CustomListItem>
<HBox class="listItems">
<Text text="• " class="items_circle" />
<Text
wrapping="true" text="{item}"/>
</HBox>
</CustomListItem>
</List>
</VBox>
<VBox height="5rem" fieldGroupIds="hideShowElements" visible="true">
<Label text="Best Practices" class="sapUiSmallTop" design="Bold" fieldGroupIds="hideShowElements"/>
<List
items="{path:'best_practices', templateShareable:false}"
includeItemInSelection="true">
<CustomListItem>
<HBox class="listItems">
<Text text="• " class="items_circle2" />
<Link wrapping="true"
text="{best_practices_name}"
target="_blank"
href="{best_practices_url}" />
</HBox>
</CustomListItem>
</List>
</VBox>
<VBox class="" height="5rem" visible="true" fieldGroupIds="hideShowElements">
<Label text="Content Responsibility" class="sapUiSmallTop" fieldGroupIds="hideShowElements" design="Bold" visible="true"/>
<List
items="{path:'content_responsibility', templateShareable:false}"
includeItemInSelection="true">
<CustomListItem>
<HBox class="listItems">
<Text text="• " class="items_circle" />
<Text
wrapping="true" text="{item}"/>
</HBox>
</CustomListItem>
</List>
</VBox>
<VBox class=" conf_move_down" height="3.5rem" visible="true" fieldGroupIds="hideShowElements">
<Label text="Confidentiality Level" design="Bold" fieldGroupIds="hideShowElements"/>
<HBox class="listItems">
<Text text="• " class="items_circle2" />
<Link wrapping="true"
text="{confidentiality_level}"
target="_blank"
href="{confidentiality_level_url}" />
</HBox>
</VBox>
<VBox class=" expandClassTrue" height="6rem" visible="true" fieldGroupIds="hideShowElements">
<Label text="Support" design="Bold" fieldGroupIds="hideShowElements"/>
<List fieldGroupIds="hideShowElements"
items="{path:'support', templateShareable:false}"
includeItemInSelection="true">
<CustomListItem class="listItems">
<HBox class="listItems">
<Text text="• " class="items_circle2" />
<Link wrapping="true"
text="{support_name}"
target="_blank"
href="{support_url}" />
</HBox>
</CustomListItem>
</List>
</VBox>
</Panel>
</l:Grid>
</ScrollContainer>
</IconTabFilter>
</items>
</IconTabBar>
</Page>
</App>
</mvc:View>
When I use "False" for stretchcontentheight, this is the top of my page:
When I use "true", the header is gone.
Does anyone know how to solve this?
Thank you very much for reading and helping
I fixed my problem with a workaround using custom headers.

Cannot position controls in Toolbar and OverflowToolbar

I'm trying to add 2 Input controls to my Toolbar with Title. But in OverflowToolbar they go to overflow area and in Toolbar control are not moved to the right side by ToolbarSpacer. How do I make this work as expected?
<Table
id="sfcTable"
mode="MultiSelect"
items="{path: 'sfcTable>/Rowsets/Rowset/0/Row', sorter: { path: 'Shop Order'}}">
<headerToolbar>
<OverflowToolbar>
<Title
text="Table Header Here"
level="H1" />
<ToolbarSpacer />
<Input
id="operationDelay"
maxLength="6"
type="Number"
description="ms"
fieldWidth="5rem">
<layoutData>
<OverflowToolbarLayoutData
priority="NeverOverflow" />
</layoutData>
</Input>
<Input
id="actionDelay"
maxLength="6"
type="Number"
description="ms"
fieldWidth="5rem">
<layoutData>
<OverflowToolbarLayoutData
priority="NeverOverflow" />
</layoutData>
</Input>
</OverflowToolbar>
</headerToolbar>
...
</Table>
OverflowToolbar image
Note that only one Input is shown.
Toolbar code:
<Table
id="sfcTable"
mode="MultiSelect"
items="{path: 'sfcTable>/Rowsets/Rowset/0/Row', sorter: { path: 'Shop Order'}}">
<headerToolbar>
<Toolbar>
<Title
text="Table Header Here"
level="H1" />
<ToolbarSpacer />
<Input
id="operationDelay"
maxLength="6"
type="Number"
description="ms"
fieldWidth="5rem">
</Input>
<Input
id="actionDelay"
maxLength="6"
type="Number"
description="ms"
fieldWidth="5rem">
</Input>
</Toolbar>
</headerToolbar>
Toolbar image
I also had the same problem at some point and ended up with wrapping the additional controls into a nested Toolbar. See working example in snippet below or at JSBin: http://jsbin.com/hofuvum/edit?html,output
<!DOCTYPE html>
<html><head>
<meta http-equiv='X-UA-Compatible' content='IE=edge' />
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
<title>JSFragment used in XmlView</title>
<!-- Load UI5, select Blue Crystal theme and the "commons" control library -->
<script id='sap-ui-bootstrap' type='text/javascript'
src='https://openui5.hana.ondemand.com/resources/sap-ui-core.js'
data-sap-ui-theme='sap_bluecrystal'
data-sap-ui-libs='sap.m, sap.ui.commons'></script>
<!-- DEFINE RE-USE COMPONENTS - NORMALLY DONE IN SEPARATE FILES -->
<!-- define an XMLView - normally done in a separate file -->
<script id="view1" type="sapui5/xmlview">
<mvc:View xmlns:core="sap.ui.core" xmlns:layout="sap.ui.commons.layout" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
controllerName="my.own.controller" xmlns:html="http://www.w3.org/1999/xhtml">
<OverflowToolbar>
<Title
text="Table Header Here"
level="H1" />
<ToolbarSpacer />
<Toolbar>
<Input
id="operationDelay"
maxLength="6"
type="Number"
description="ms"
fieldWidth="5rem">
</Input>
<Input
id="actionDelay"
maxLength="6"
type="Number"
description="ms"
fieldWidth="5rem">
</Input>
</Toolbar>
</OverflowToolbar>
</mvc:View>
</script>
<script>
// define a new (simple) Controller type
sap.ui.controller("my.own.controller", {
});
/*** THIS IS THE "APPLICATION" CODE ***/
// instantiate the View
var myView = sap.ui.xmlview("myView", {viewContent:jQuery('#view1').html()}); // accessing the HTML inside the script tag above
// put the View onto the screen
myView.placeAt('content');
</script>
</head>
<body class='sapUiBody'>
<div id='content'></div>
</body>
</html>
The problem is how you apply fieldWidth...
Here is working example based on your code: https://jsbin.com/pivodos/edit?html,output
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SAPUI5 single file template | nabisoft</title>
<script
src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-theme="sap_belize"
data-sap-ui-libs="sap.m"
data-sap-ui-compatVersion="edge"
data-sap-ui-preload="async"></script>
<!-- XMLView -->
<script id="myXmlView" type="ui5/xmlview">
<mvc:View
xmlns="sap.m"
xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc">
<Table>
<headerToolbar>
<OverflowToolbar>
<Title text="Table with OverflowToolbar" level="H1" />
<ToolbarSpacer />
<Input
maxLength="6"
type="Number"
description="ms"
width="10rem"
fieldWidth="50%">
<layoutData>
<OverflowToolbarLayoutData priority="NeverOverflow" />
</layoutData>
</Input>
<Input
maxLength="6"
type="Number"
description="ms"
width="10rem"
fieldWidth="50%">
<layoutData>
<OverflowToolbarLayoutData priority="NeverOverflow" />
</layoutData>
</Input>
</OverflowToolbar>
</headerToolbar>
</Table>
<Table>
<headerToolbar>
<Toolbar>
<Title text="Table with Toolbar" level="H1" />
<ToolbarSpacer />
<Input
maxLength="6"
type="Number"
description="ms"
width="10rem"
fieldWidth="50%">
</Input>
<Input
maxLength="6"
type="Number"
description="ms"
width="10rem"
fieldWidth="50%">
</Input>
</Toolbar>
</headerToolbar>
</Table>
</mvc:View>
</script>
<script>
sap.ui.getCore().attachInit(function () {
"use strict";
//### THE APP: place the XMLView somewhere into DOM ###
sap.ui.xmlview({
viewContent : jQuery("#myXmlView").html()
}).placeAt("content");
});
</script>
</head>
<body class="sapUiBody">
<div id="content"></div>
</body>
</html>

Tiles Not Rendering While Put Inside Grid

I am trying to render StandardTile in a Grid, but due to some reason it's not working. however, it works when I remove the Grid & Panel from my code.
Can anyone point out what exactly am I doing wrong here?
<mvc:View xmlns:mvc="sap.ui.core.mvc"
xmlns:core="sap.ui.core" xmlns:l="sap.ui.layout" xmlns="sap.m"
controllerName="hanaDashBoard.controller.Home">
<Page showHeader="false" enableScrolling="false">
<Toolbar class="sapUiTinyMarginTop" id="toolbar1" height="10%">
<ComboBox id="SidCombo" width="11.5%" showSecondaryValues="true"
items="{
path: '/results'
}" selectionChange="SidSelect">
<core:ListItem key='{Key}' text='{Sid}'
additionalText='{Template}' />
</ComboBox>
<Text id="TemplateText"></Text>
<Text id="SltText"></Text>
<ToolbarSpacer />
<Button id="UserName" icon="sap-icon://kpi-managing-my-area"
enabled="false" type="Transparent" />
</Toolbar>
<l:Grid
id="leGrid"
class="sapUiSmallMarginTop"
hSpacing="2"
visible="false"
>
<l:content>
<Panel width="auto" class="sapUiResponsiveMargin">
<content>
<TileContainer id="container"
width="100%" height="100%" visible="true" tileDelete="handleTileDelete"
tiles="{/TileCollection}">
<StandardTile icon="{icon}" type="{type}" number="{number}"
numberUnit="{numberUnit}" title="{title}" info="{info}"
infoState="{infoState}" press="handleTilepress" />
</TileContainer>
</content>
<layoutData>
<l:GridData span="L12 M12 S12" />
</layoutData>
</Panel>
</l:content>
</l:Grid>
<footer>
<Toolbar>
<ToolbarSpacer />
<Button id="editbutton" text="Edit" press="tilePressed" />
<ToolbarSpacer />
</Toolbar>
</footer>
</Page>
</mvc:View>

Wrong Panel content height with ui.table (visibleRowCountMode="Auto")

I want to have a layout which has a fixed size panel with a form at the top and a panel with a grid which takes the remaining space at the bottom. I have managed that the panels have the correct size - so the section html tag of the grid's panel has 100% and correctly spans but the height of the nested div for the content is calculated to 0px.
What definition is necessary or missing so that the grid takes the complete remaining space?
<mvc:View
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
xmlns:l="sap.ui.layout"
xmlns:f="sap.ui.layout.form"
xmlns:t="sap.ui.table"
height="100%">
<l:FixFlex class="fixFlexFixedSize" fixContentSize="100px">
<l:fixContent>
<Panel class="sapUiNoContentPadding">
<headerToolbar>
<Toolbar>
<Title text="Form" level="H2" />
</Toolbar>
</headerToolbar>
<content>
<f:Form editable="true">
<f:layout>
<f:ResponsiveGridLayout
labelSpanL="2"
labelSpanM="2"
emptySpanL="1"
emptySpanM="1"
columnsL="2"
columnsM="2" />
</f:layout>
<f:formContainers>
<f:FormContainer>
<f:formElements>
<f:FormElement label="Lastname">
<f:fields>
<Input id="lastname" />
</f:fields>
</f:FormElement>
</f:formElements>
</f:FormContainer>
<f:FormContainer>
<f:FormElement label="Firstname">
<f:fields>
<Input id="firstname" />
</f:fields>
</f:FormElement>
</f:FormContainer>
</f:formContainers>
</f:Form>
</content>
</Panel>
</l:fixContent>
<l:flexContent>
<Panel height="100%" class="sapUiNoContentPadding">
<headerToolbar>
<Toolbar>
<Title text="Grid" level="H2" />
<ToolbarSpacer />
<Button icon="sap-icon://add" text="new" press="newEntry" />
</Toolbar>
</headerToolbar>
<content>
<t:Table
rows="{entries>/result}"
enableSelectAll="false"
selectionMode="None"
visibleRowCountMode="Auto"
height="100%">
<t:columns>
<t:Column width="5rem" >
<Label text="{i18n>entrieslist.column.name}" />
<t:template>
<Link text="{entries>lastname}" press="showDetailsPage"/>
</t:template>
</t:Column>
<t:Column width="5rem" >
<t:template>
<Text text="{entries>firstname}" />
</t:template>
</t:Column>
<t:Column width="11rem" sorted="true" sortProperty="{entries>telephone} ">
<Label text="{i18n>entrieslist.column.number}" />
<t:template>
<Text text="{entries>telephone}" />
</t:template>
</t:Column>
<t:Column width="11rem" >
<Label text="{i18n>entrieslist.column.street}" />
<t:template>
<Text text="{entries>street}" />
</t:template>
</t:Column>
</t:columns>
</t:Table>
</content>
</Panel>
</l:flexContent>
</l:FixFlex>
</mvc:View>

Sapui5 - Adjusting the size in simple form

I am developing an application using sapui5 and I am having a problem with the sizing of the "dropdownbox" in simple form. The items from sap.m package seem to automatically adjust to the size of the simple form content, while other items from packages like sa.ui.commons dont adjust as well.
How do I adjust the size of the dropdownbox? I tried setting the width and the height to "100%" but that did not work.
Adding the code:
<c:FragmentDefinition
xmlns:mvc="sap.ui.core.mvc"
xmlns:l="sap.ui.layout"
xmlns:f="sap.ui.layout.form"
xmlns:c="sap.ui.core"
xmlns:co="sap.ui.commons"
xmlns:col="sap.ui.commons.layout"
xmlns="sap.m">
<l:Grid
defaultSpan="L12 M12 S12"
width="auto">
<l:content>
<f:SimpleForm
minWidth="800"
maxContainerCols="2"
editable="true"
layout="ResponsiveGridLayout"
title="General Info"
labelSpanL="3"
labelSpanM="3"
emptySpanL="4"
emptySpanM="4"
columnsL="2"
columnsM="2"
class="editableForm">
<f:content>
<Label text="Employee Name" />
<co:DropdownBox width="200px" >
<c:ListItem text="Emp1"/>
<c:ListItem text="Emp2"/>
</co:DropdownBox>
<Label text="Type of Travel" />
<Select >
<c:ListItem key="B" text="Business"/>
<c:ListItem key="O" text="Other"/>
</Select>
</f:content>
</f:SimpleForm>
</l:content>
</l:Grid>
</c:FragmentDefinition>
How about just omitting the width of the commons control, just as you did with the m control? That scales the sap.ui.commons.DropdownBox just as wide as the sap.m.Select control.
On a sidenote, I would not mix m controls with common controls; you may run into CSS issues
EDIT: See this working example, both sap.ui.commons.DropdownBox and sap.m.Select are of equal size:
sap.ui.controller("view1.initial", {
onInit : function() { }
});
var app = new sap.m.App({});
var oView = sap.ui.xmlview({
viewContent: jQuery("#view1").html()
});
app.addPage(oView);
app.placeAt("uiArea");
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<title>SAPUI5 template</title>
<script id="sap-ui-bootstrap"
src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-xx-bindingSyntax="complex"
data-sap-ui-libs="sap.m"></script>
<script id="view1" type="ui5/xmlview">
<mvc:View
controllerName="view1.initial"
xmlns:mvc="sap.ui.core.mvc"
xmlns:l="sap.ui.layout"
xmlns:f="sap.ui.layout.form"
xmlns:c="sap.ui.core"
xmlns:co="sap.ui.commons"
xmlns:col="sap.ui.commons.layout"
xmlns="sap.m">
<l:Grid
defaultSpan="L12 M12 S12"
width="auto">
<l:content>
<f:SimpleForm
minWidth="800"
maxContainerCols="2"
editable="true"
layout="ResponsiveGridLayout"
title="General Info"
labelSpanL="3"
labelSpanM="3"
emptySpanL="4"
emptySpanM="4"
columnsL="2"
columnsM="2"
class="editableForm">
<f:content>
<Label text="Employee Name" />
<co:DropdownBox>
<c:ListItem text="Emp1"/>
<c:ListItem text="Emp2"/>
</co:DropdownBox>
<Label text="Type of Travel" />
<Select>
<c:ListItem key="B" text="Business"/>
<c:ListItem key="O" text="Other"/>
</Select>
</f:content>
</f:SimpleForm>
</l:content>
</l:Grid>
</mvc:View>
</script>
</head>
<body class="sapUiBody" role="application">
<div id="uiArea"></div>
</body>
</html>