I am trying to call the OData service with Smart Table. First I created a simple table and with that I am can see the data in table. Then I added SmartTable on the same page but It is showing no data. Even no columns are being created. What could be the reason ?
<mvc:View controllerName="com.siemens.hc.controller.View1" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m" xmlns:smartField="sap.ui.comp.smartfield" xmlns:smartFilterBar="sap.ui.comp.smartfilterbar"
xmlns:smartTable="sap.ui.comp.smarttable">
<App>
<pages>
<Page title="{i18n>title}">
<content>
<Table id="idProductsTable" inset="false" items="{/SafetyUpdateSet}">
<headerToolbar>
<Toolbar>
<Title text="Product" level="H2"/>
</Toolbar>
</headerToolbar>
<columns>
<Column width="12em">
<Text text="Product"/>
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<ObjectIdentifier title="{Notification}"/>
</cells>
</ColumnListItem>
</items>
</Table>
<smartTable:SmartTable id="smartTable_ResponsiveTable" tableType="ResponsiveTable" editable="false" entitySet="SafetyUpdateSet"
useVariantManagement="false" useTablePersonalisation="false" header="Notification" showRowCount="true" useExportToExcel="false"
enableAutoBinding="true">
</smartTable:SmartTable>
</content>
</Page>
</pages>
</App>
</mvc:View>
I have created the destination in neo-app.json file and created the model in Manifest.json file.
Regards,
Mayank
I had to defined the columns Manually in my SmartTable.
<smartTable:SmartTable id="smartTable_ResponsiveTable" tableType="ResponsiveTable" editable="false" entitySet="EntitySet"
useVariantManagement="false" useTablePersonalisation="false" header="Notification" showRowCount="true" useExportToExcel="false"
enableAutoBinding="true" initiallyVisibleFields="Col1,Col2,Col3,Col4,Col5"></smartTable:SmartTable>
You have a model named "invoice". According to the documentation named models are not supported by smart controls.
You can also use an annotation file, provided your oData service supports annotations. Create a new annotation file, annotate the entity set, and add LineItem/DataField annotations. That should display the fields you selected.
<Annotations Target="<oData.Service>">
<Annotation Term="UI.LineItem">
<Collection>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="Field1"/>
<PropertyValue Property="Label" String="{i18n>Field1Label}"/>
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="Field2"/>
<PropertyValue Property="Label" String="{i18n>Field2Label}"/>
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="Field3"/>
<PropertyValue Property="Label" String="{i18n>Field3Label}"/>
</Record>
</Collection>
</Annotation>
</Annotations>
You can leave out the 'label' properties if you oData field names are to your liking.
I just faced this error.
This may be resolved by adding
xmlns:app="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"
at the top of view. Although I could not find any reason/explanation of adding this, but I believe this is related to FlexItemData.
Related
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(?)
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>
I have a smarttable with custom toolbar and a table inside.
Now I want to put just the table and not the whole smarttable inside of a scroll container. But if I do that then data is not bound to the inner table anymore.
<smartTable:SmartTable id="_0" entitySet="ProjectOrganisationHeadSet" tableBindingPath="/ProjectOrganisationHeadSet"
tableType="ResponsiveTable" smartFilterId="prorgrelWorklistFilterBarId" showFullScreenButton="true" useVariantManagement="false"
enableAutoBinding="true" ignoredFields="" beforeRebindTable="handleBeforeRebindTable" app:myStatus="EDIT"
initiallyVisibleFields="ProjectorgaId,Title,....">
<smartTable:customToolbar>
<OverflowToolbar design="Transparent">
<ToolbarSpacer/>
<Button type="Transparent" press="onCreateBtnPress" icon="sap-icon://add"/>
</OverflowToolbar>
</smartTable:customToolbar>
<ScrollContainer id="__scrollContainer0" horizontal="true" vertical="true">
<Table id="table0" mode="None" busyIndicatorDelay="0">
<items>
<ColumnListItem type="Navigation" press="onPress">
<cells>
<Text text="{path: 'ProjectorgaId', formatter: '.formatter.intNumber'}"/>
</cells>
</ColumnListItem>
</items>
</Table>
</ScrollContainer>
While it must show 40 rows, it shows nothing. If I remove the scrollcontainer all rows will be shown.
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;
}
:)
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.