Select multiple rows in a SmartTable - sapui5

I am unable to find any property that can help to multiselect the rows in a SmartTable.
I have worked with simple tables. There the property mode="MultiSelect" solves this problem, but in SmartTable this does not work.
Please suggest me a property that can be used to select multiple rows in a SmartTable
<mvc:View xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" controllerName="Workspace.controller.SmartField"
xmlns:smartFilterBar="sap.ui.comp.smartfilterbar" xmlns:smartTable="sap.ui.comp.smarttable">
<smartFilterBar:SmartFilterBar id="smartFilterBar" entitySet="PLANT" persistencyKey="SmartFilter_Explored">
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration key="PLANTID" visibleInAdvancedArea="true" preventInitialDataFetchInValueHelpDialog="false"> </smartFilterBar:ControlConfiguration>
<smartFilterBar:ControlConfiguration key="STATUS" visibleInAdvancedArea="true" preventInitialDataFetchInValueHelpDialog="false"> </smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
</smartFilterBar:SmartFilterBar>
<OverflowToolbar design="Transparent">
<ToolbarSpacer/>
<OverflowToolbarButton icon="sap-icon://add" text="Add" press="AddRow"/>
<OverflowToolbarButton icon="sap-icon://delete" text="Delete" press="Delete"/>
<OverflowToolbarButton icon="sap-icon://drop-down-list" text="Filter"/>
</OverflowToolbar>
<smartTable:SmartTable id="tableplant" smartFilterId="smartFilterBar" tableType="ResponsiveTable" editable="false" entitySet="PLANT"
initiallyVisibleFields="PLANTID,PTYPE,DESCRIPTION,TYPE,STATUS,ASSIGNED,ATTACHMENT" useVariantManagement="false" demandPopin="true"
useTablePersonalisation="true" header="Products" showRowCount="true" useExportToExcel="false" enableAutoBinding="true"></smartTable:SmartTable>
</mvc:View>

if you want to make use of a multi-select you could integrate a sap.m.Table in your smarttable:
<smartTable:SmartTable id="tableplant" smartFilterId="smartFilterBar" tableType="ResponsiveTable" editable="false" entitySet="PLANT"
initiallyVisibleFields="PLANTID,PTYPE,DESCRIPTION,TYPE,STATUS,ASSIGNED,ATTACHMENT" useVariantManagement="false" demandPopin="true"
useTablePersonalisation="true" header="Products" showRowCount="true" useExportToExcel="false" enableAutoBinding="true">
<!-- Table integration -->
<Table mode="MultiSelect" growingThreshold="100" growing="true"
growingScrollToLoad="true">
<columns>
...
</columns>
<items>
...
</items>
</Table>
<!-- EndTable integration -->
</smartTable:SmartTable>

Related

UI5: SmartTable Personalisation/Variant Management Error

Hello Experts, I'm unsure why this error (pictured) is appearing. As far as I know, SmartTable should be able to take care of everything to do with variant management, right? In my controller, I dont have any code pertaining to variant management.
Here is the below code for my smartTable:
<smartTable:SmartTable id="smartTable" entitySet="Z9NRS_REQUESTSet" tableType="ResponsiveTable"
useExportToExcel="true" beforeExport="onBeforeExport" demandPopin="true" useVariantManagement="true" useTablePersonalisation="true"
header="Manage Requests" showRowCount="true" persistencyKey="SmartTableAnalytical_Explored" enableAutoBinding="true"
class="sapUiResponsiveContentPadding" initiallyVisibleFields="ZNRS_REQUEST,ZREQUESTOR_NAME,ZPRODUCT_FAMILY,ZOEM,ZTIER,ZCUSTOMER_PN,ZMATERIAL_NO,ZSTATUS_DESC,ZCONNECTOR_CONFIG" >
<smartTable:customToolbar>
<OverflowToolbar>
<ToolbarSpacer/>
<!--<Button icon="sap-icon://settings" type="Accept" />-->
</OverflowToolbar>
</smartTable:customToolbar>
<Table mode="SingleSelectMaster" selectionChange="onPress" inset="false" >
<columns>
<Column>
<Text text="Status"/>
<customData>
<!--p13nData is a keyword that links smartTable to this and let it identify this custom column-->
<core:CustomData key="p13nData" value='\{"columnKey":"ZSTATUS_DESC",
"leadingProperty":"ZSTATUS_DESC", "sortProperty":"ZSTATUS_DESC",
"filterProperty":"ZSTATUS_DESC", "columnIndex":7}' />
</customData>
</Column>
</columns>
<items>
<ColumnListItem >
<!--<ObjectStatus text="{ZSTATUS_DESC}" />-->
<ObjectStatus text="{ZSTATUS_DESC}" state="{path:'ZOVERALL_STATUS', formatter:'.formatter.DrawingStatus'}" />
</ColumnListItem>
</items>
</Table>
<!-- layout data used to make the table growing but the filter bar fixed -->
<smartTable:layoutData>
<FlexItemData growFactor="1" baseSize="0%"/>
</smartTable:layoutData>
</smartTable:SmartTable>
When I deployed and tested variant management it worked. But in FLPSandbox it wasn't working, so I guess it had to do with the app's access to some backend system(?)

Error: Cannot add direct child without default aggregation defined for control sap.f.cards.Header

I'm trying to add the custom data aggregation to a card control header. I've tried a lot of things but nothing seems to work, I'm always getting the same error:
Cannot add direct child without default aggregation defined for control sap.f.cards.Header
I also tried attaching the aggregation through the controller an it worked fine but I need it in my XML view.
This is my code:
<mvc:View controllerName="Dashboard2.Dashboard2.controller.View2" xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m"
xmlns:f="sap.f" xmlns:w="sap.ui.integration.widgets" xmlns:card="sap.f.cards" xmlns:layout="sap.ui.layout"
xmlns:core="sap.ui.core.customData" xmlns:viz.feeds="sap.viz.ui5.controls.common.feeds" xmlns:viz.data="sap.viz.ui5.data"
xmlns:viz="sap.viz.ui5.controls">
<ScrollContainer height="100%" width="100%" vertical="true">
<f:GridContainer snapToRow="false" id="containerid">
<f:layout>
<f:GridContainerSettings rowSize="84px" columnSize="84px" gap="6px"/>
</f:layout>
<f:layoutXS>
<f:GridContainerSettings rowSize="70px" columnSize="70px" gap="6px"/>
</f:layoutXS>
<f:Card class="sapUiMediumMargin" width="300px" height="23rem" id="batchlectura">
<f:layoutData>
<f:GridContainerItemLayoutData columns="4"/>
</f:layoutData>
<f:header>
<card:Header title="{datos>Proceso}" subtitle="{path:'datos>Hora', formatter:'.formatter.Hour' }" iconSrc="sap-icon://insurance-house"
statusText="{path:'datos>Estatus', formatter:'.formatter.Estatus'}">
<customData>
<core:CustomData key="Name" value="Contactname"/>
</customData>
</card:Header>
</f:header>
<f:content>
<viz:VizFrame id="idVizFrame" uiConfig="{applicationSet:'fiori'}" height='100%' width="100%" vizType='column'>
<viz:dataset>
<viz.data:FlattenedDataset data="{datos>/results}">
<viz.data:dimensions>
<viz.data:DimensionDefinition name="Week" value="1"/>
</viz.data:dimensions>
<viz.data:measures>
<viz.data:MeasureDefinition name="Estimado" value="{datos>Estimado}"/>
<viz.data:MeasureDefinition name="Actual" value="{datos>Actual}"/>
</viz.data:measures>
</viz.data:FlattenedDataset>
</viz:dataset>
<viz:feeds>
<viz.feeds:FeedItem id='valueAxisFeed' uid="valueAxis" type="Measure" values="Estimado"/>
<viz.feeds:FeedItem id='valueAxisFeed2' uid="valueAxis" type="Measure" values="Actual"/>
<viz.feeds:FeedItem id='categoryAxisFeed' uid="categoryAxis" type="Dimension" values="Week"/>
</viz:feeds>
</viz:VizFrame>
</f:content>
</f:Card>
</f:GridContainer>
</ScrollContainer>
</mvc:View>
Nothing seems to work.
I hope someone can help me.
I believe <customData> should be <card:customData> otherwise the default namespace which is sap/m will be used.

How to delete the margin around SmartFilterBar?

I have SmartFilterBar inside a SplitPane that looks as following:
and I would like to delete the spaces around the SmartFilterBar.
The code for the view:
<l:SplitPane requiredParentWidth="400" demandPane="true" id="default">
<Panel height="100%">
<smartFilterBar:SmartFilterBar id="smartFilterBar" entitySet="ZMM_C_CLASSIFICATION" search="_onSearch">
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration key="ClassType" visibleInAdvancedArea="true" preventInitialDataFetchInValueHelpDialog="false"></smartFilterBar:ControlConfiguration>
<smartFilterBar:ControlConfiguration key="ClassNum" visibleInAdvancedArea="true" preventInitialDataFetchInValueHelpDialog="false"></smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
</smartFilterBar:SmartFilterBar>
<Tree id="classTree" items="{path: 'Tree>/'}" toggleOpenState="onToggleOpenState">
<CustomTreeItem>
<FlexBox width="100%" alignItems="Center" justifyContent="SpaceBetween">
<items>
<Label text="{Tree>text}" wrapping="true"/>
<Button icon="sap-icon://display" type="Transparent" press="onItemPress"/>
</items>
</FlexBox>
</CustomTreeItem>
</Tree>
</Panel>
<l:layoutData>
<l:SplitterLayoutData size="30%"/>
</l:layoutData>
</l:SplitPane>
Update
I also tried:
<l:SplitPane requiredParentWidth="400" demandPane="true" id="default">
<l:content>
<smartFilterBar:SmartFilterBar id="smartFilterBar" entitySet="ZMM_C_CLASSIFICATION" search="_onSearch">
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration key="ClassType" visibleInAdvancedArea="true" preventInitialDataFetchInValueHelpDialog="false"></smartFilterBar:ControlConfiguration>
<smartFilterBar:ControlConfiguration key="ClassNum" visibleInAdvancedArea="true" preventInitialDataFetchInValueHelpDialog="false"></smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
</smartFilterBar:SmartFilterBar>
<Tree id="classTree" items="{path: 'Tree>/'}" toggleOpenState="onToggleOpenState">
<CustomTreeItem>
<FlexBox width="100%" alignItems="Center" justifyContent="SpaceBetween">
<items>
<Label text="{Tree>text}" wrapping="true"/>
<Button icon="sap-icon://display" type="Transparent" press="onItemPress"/>
</items>
</FlexBox>
</CustomTreeItem>
</Tree>
</l:content>
<l:layoutData>
<l:SplitterLayoutData size="30%"/>
</l:layoutData>
</l:SplitPane>
Then controls disappear:
You can use the SAP UI5 class to achieve this on the control by specifying the class
Depending on your need which is margin or padding you can choose.
sapUiNoContentPadding or sapUiNoMargin
Padding:
https://help.sap.com/saphelp_uiaddon10/helpdata/en/c7/1f6df62dae47ca8284310a6f5fc80a/frameset.htm
Margin:
https://help.sap.com/saphelp_uiaddon10/helpdata/en/77/7168ffe8324873973151dae2356d1c/frameset.htm
you can specify in example below
<l:SplitPane requiredParentWidth="400" demandPane="true" id="default" class="sapUiNoContentPadding ">
Hope this will help you, As per the new version(1.56.8) you need to remove the class sapUiCompFilterBarNonPhone which is adding the padding to the filter bar. Remove the UI5 generated class and add sapUiTinyMargin class to have some margin around the filter bar.
You can achieve using the following code.
var oFilterBar = sap.ui.getCore().byId("YourFilterBarId");//Update your filter Bar ID
if (oFilterBar)
oFilterBar.removeStyleClass("sapUiCompFilterBarNonPhone").addStyleClass("sapUiTinyMargin");

Why Does Object Page Section Title Come in Capital Letters and How to Disable It

When I try to add ObjectPageSection inside <sections> of an ObjectPageLayout, I see the title coming in capital letters.
Could anyone explain why? I would like to show it as title-cased.
Here is the snippet of the code:
<mvc:View
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.uxap"
xmlns:layout="sap.ui.layout"
xmlns:m="sap.m"
xmlns:blockcolor="sap.uxap.sample.SharedBlocks"
controllerName="personal.controller.Object"
height="100%"
>
<ObjectPageLayout id="ObjectPageLayout"
enableLazyLoading="false"
showAnchorBarPopover="false"
showFooter="true"
>
<headerTitle>
<ObjectPageHeader objectTitle="{DataAgingGroupName}"/>
</headerTitle>
<sections>
<ObjectPageSection title="Section 2">
<subSections>
<ObjectPageSubSection title="Deletable Data Subjects">
<blocks>
<Table xmlns="sap.m" id="table"
mode="SingleSelectLeft"
width="auto"
items="{invoice>/Invoices}"
noDataText="{worklistView>/tableNoDataText}"
busyIndicatorDelay="{worklistView>/tableBusyDelay}"
growing="true"
growingScrollToLoad="true"
updateFinished="onUpdateFinished"
>
<columns>
<Column id="nameColumn1">
<Text text="Data Subject"/>
</Column>
</columns>
<items>
<ColumnListItem
type="Navigation"
press="onPress"
>
<cells>
<Text id="__picker0"
text="{invoice>ProductName}"
width="100%"
/>
</cells>
</ColumnListItem>
</items>
</Table>
</blocks>
</ObjectPageSubSection>
</subSections>
</ObjectPageSection>
<ObjectPageSection title="Section 1">
<subSections>
<ObjectPageSubSection title="General Information"/>
</subSections>
</ObjectPageSection>
</sections>
<footer>
<m:OverflowToolbar>
<m:ToolbarSpacer/>
<m:Button
text="Delete"
type="Reject"
press="handleDelete"
/>
</m:OverflowToolbar>
</footer>
</ObjectPageLayout>
</mvc:View>
You can, and you should if you're following the Fiori Guidelines, disable the uppercase via upperCaseAnchorBar since the default value is true there. The same goes for the <ObjectPageSection> which has the property titleUppercase enabled by default. So, disable them explicitly:
<ObjectPageLayout upperCaseAnchorBar="false" ...>
<sections>
<ObjectPageSection titleUppercase="false" ...>
The <ObjectPageSubSection>, on the other hand, provides the property titleUppercase too, but its default value is already false there.
It comes from the css
.sapUxAPObjectPageSectionTitleUppercase {
text-transform: uppercase;
}
:)

onPress-Event in SmartTables

In a normal list we have sth like this
<List noDataText="---" id="__list0" items="{model>/Orders}">
<items>
<StandardListItem type="Navigation" title="{model>OrderName}" press="onPress" />
</items>
</List>
So we set the press-Event in the Items, but if we have a SmartTable we do not have the inner
<StandardListItem type="Navigation" title="{model>OrderName}" press="onPress" />
I just have:
<sap.ui.comp.smarttable:SmartTable xmlns:sap.ui.comp.smarttable="sap.ui.comp.smarttable"
height="100%"
width="100%"
direction="Column"
fitContainer="true"
tableType="ResponsiveTable"
header="Smart Table"
enableAutoBinding="true"
id="__table0"
entitySet="Datas"/>
//Not the same Model in this case
How can I set an onPress event for the columns?
Thank you very much for your Help.