in fact my question has exactly been asked here SAPUI5 OData Binding not refreshing on route navigation before, but since there was no answer provided in that particular post, I need to repost it somehow in here, because neither I cant comment on the mentioned post, nor can I message the poster.
Almost everything in my App works as it should be, but all datafields of the ObjectHeaders in Detailview will only be written once. After a value has been written for the first time, it is never changed again.
Does anybody have an idea why it behaves like that?
EDIT: You are right guys, I am sry.
Thats the init function where I set the model of the App:
init : function () {
this.oListSelector = new ListSelector();
this._oErrorHandler = new ErrorHandler(this);
// set the device model
this.setModel(models.createDeviceModel(), "device");
// set the FLP model
this.setModel(models.createFLPModel(), "FLP");
// set the dataSource model
this.setModel(new sap.ui.model.json.JSONModel({"uri":"*placeholder*/sap/opu/odata/SAP/Z_APPROVALSERVICE_SRV/"}), "dataSource");
// call the base component's init function and create the App view
UIComponent.prototype.init.apply(this, arguments);
// create the views based on the url/hash
this.getRouter().initialize();
}
Followed by my Master view of the Split app:
<mvc:View xmlns:mvc="sap.ui.core.mvc" controllerName="com.sap.build.standard.approvalApp.controller.Worklist" xmlns:m="sap.m">
<m:Page showHeader="true" title="{masterView>/title}" showFooter="true">
<m:content>
<m:List id="sap_m_List_1" mode="SingleSelectMaster" width="100%" headerText="Header" footerText="" backgroundDesign="Solid" showSeparators="All" growing="false" growingThreshold="20" growingScrollToLoad="true" itemPress="_onListItemPress1" items="{/GeneralDataSet}">
<m:items>
<m:ObjectListItem intro="{Description}" title="{path: 'DueDate', type: 'sap.ui.model.type.Date', formatOptions: { UTC: true, style: 'short' }}" number="{Priority}" numberUnit="" numberState="None" type="Active" selected="false" showMarkers="false">
<m:attributes/>
<m:firstStatus>
<m:ObjectStatus title="Estimated Validation Effort" text="{EstimatedValidationEffort}" state="None"/>
</m:firstStatus>
<m:secondStatus>
<m:ObjectStatus title="Estimated Implementation Effort" text="{EstimatedImplEffort}" state="None"/>
</m:secondStatus>
</m:ObjectListItem>
</m:items>
<m:headerToolbar>
<m:Toolbar visible="true" enabled="true" width="" design="Solid">
<m:content>
<m:SearchField value="" placeholder="Insert term to search for" showSearchButton="false" visible="true" liveChange="_onSearchFieldLiveChange"/>
</m:content>
</m:Toolbar>
</m:headerToolbar>
</m:List>
</m:content>
<m:footer>
<m:Bar design="Footer">
<m:contentLeft/>
<m:contentMiddle/>
<m:contentRight/>
</m:Bar>
</m:footer>
<m:headerContent/>
<m:subHeader/>
</m:Page>
... the Detail View
<mvc:View xmlns:mvc="sap.ui.core.mvc" controllerName="com.sap.build.standard.approvalApp.controller.BusinessTransaction" xmlns:m="sap.m" xmlns:layout="sap.ui.layout" xmlns:form="sap.ui.layout.form">
<m:Page showHeader="true" title="Master View" showFooter="true" showNavButton="false">
<m:content>
<layout:VerticalLayout width="100%" visible="true">
<layout:content>
<m:ObjectHeader intro="Due Date" title="{path: 'DueDate', type: 'sap.ui.model.type.Date', formatOptions: { UTC: true, style: 'short' }}" number="{Priority}" numberUnit="" numberState="None" showMarkers="false" markFavorite="false" markFlagged="false" backgroundDesign="Transparent" condensed="false">
<m:attributes>
<m:ObjectAttribute title="" text="{Description}" active="false"/>
</m:attributes>
<m:statuses/>
</m:ObjectHeader>
<m:IconTabBar expandable="true" expanded="true" applyContentPadding="false" backgroundDesign="Solid" upperCase="false" visible="true" selectedKey="Ok">
<m:content/>
<m:items>
<m:IconTabFilter icon="sap-icon://hint" iconColor="Default" text="Header Data" count="" design="Vertical" enabled="true" showAll="false" textDirection="Inherit" visible="true">
<m:content>
<m:ObjectHeader intro="" title="{ID}" icon="" number="" numberUnit="" numberState="None" showMarkers="false" markFavorite="false" markFlagged="false" backgroundDesign="Translucent" condensed="false">
<m:attributes>
<m:ObjectAttribute title="Current Status" text="{Status}" active="false"/>
<m:ObjectAttribute title="Category" text="{Category}" active="false"/>
<m:ObjectAttribute title="Classification" text="{Classification}" active="false"/>
<m:ObjectAttribute title="Assignee" text="{Assignee}" active="false"/>
<m:ObjectAttribute title="Created by" text="{CreatedBy}" active="false"/>
<m:ObjectAttribute title="Created at" text="{path: 'CreatedAt', type: 'sap.ui.model.type.Date', formatOptions: { UTC: true, style: 'short' }}" active="false"/>
<m:ObjectAttribute title="Last changed by" text="{LastChangedBy}" active="false"/>
<m:ObjectAttribute title="Last changed at" text="{path: 'LastChangedAt', type: 'sap.ui.model.type.Date', formatOptions: { UTC: true, style: 'short' }}" active="false"/>
</m:attributes>
<m:statuses/>
</m:ObjectHeader>
</m:content>
</m:IconTabFilter>
<m:IconTabFilter icon="sap-icon://comment" iconColor="Default" text="Comments" count="" design="Vertical" showAll="false" textDirection="Inherit" enabled="true" visible="true" iconDensityAware="false">
<m:content>
<m:List width="100%" growing="false" growingThreshold="20" growingScrollToLoad="false" backgroundDesign="Solid" items="{commented}">
<m:items>
<m:FeedListItem icon="" sender="{ID}" text="{CreatedBy}" info="{path: 'CreatedAt', type: 'sap.ui.model.type.Date', formatOptions: { UTC: true, style: 'short' }}" timestamp="{Comment}"/>
</m:items>
</m:List>
<m:FeedInput showIcon="false" icon="" placeholder="Type your comment here" enabled="true" visible="true" maxLength="0" buttonTooltip="Submit"/>
</m:content>
</m:IconTabFilter>
<m:IconTabFilter icon="sap-icon://approvals" iconColor="Default" text="Approvals" count="" design="Vertical" showAll="false" textDirection="Inherit" enabled="true" visible="true" iconDensityAware="false">
<m:content>
<m:List id="approvalList" mode="SingleSelectMaster" width="100%" headerText="Header" footerText="" backgroundDesign="Solid" showSeparators="All" growing="true" growingThreshold="20" growingScrollToLoad="true" items="{wantToBeApproved}" press="_onButtonPress8">
<m:infoToolbar>
<m:Toolbar width="100%" height="auto" design="Auto" visible="false" enabled="true">
<m:content>
<m:Label text="Label" design="Standard" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
</m:content>
</m:Toolbar>
</m:infoToolbar>
<m:headerToolbar>
<m:Toolbar visible="true" enabled="true" width="" design="Solid">
<m:content>
<m:SearchField placeholder="Search" showSearchButton="true" visible="true" width="100%"/>
</m:content>
</m:Toolbar>
</m:headerToolbar>
<m:items>
<m:ObjectListItem intro="{ID}" title="{ApproverRole}" number="{Decision}" numberUnit="" numberState="None" type="Active" selected="true" showMarkers="false">
<m:attributes>
<m:ObjectAttribute text="{ApproverName}" active="false"/>
<m:ObjectAttribute text="{ApproverUser}" active="false"/>
</m:attributes>
<m:firstStatus>
<m:ObjectStatus text="{ApproverRole}" state="None"/>
</m:firstStatus>
<m:secondStatus>
<m:ObjectStatus title="Pass" text="{Pass}" state="None"/>
</m:secondStatus>
</m:ObjectListItem>
</m:items>
</m:List>
</m:content>
</m:IconTabFilter>
<m:IconTabFilter icon="sap-icon://project-definition-triangle" iconColor="Default" text="Change Definitions" count="" design="Vertical" showAll="false" textDirection="Inherit" enabled="true" visible="true" iconDensityAware="false">
<m:content>
<m:List mode="SingleSelectMaster" width="100%" headerText="Header" footerText="" backgroundDesign="Solid" showSeparators="All" growing="true" growingThreshold="20" growingScrollToLoad="true">
<m:infoToolbar>
<m:Toolbar width="100%" height="auto" design="Auto" visible="false" enabled="true">
<m:content>
<m:Label text="Label" design="Standard" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
</m:content>
</m:Toolbar>
</m:infoToolbar>
<m:headerToolbar>
<m:Toolbar visible="true" enabled="true" width="" design="Solid">
<m:content>
<m:SearchField placeholder="Search" showSearchButton="true" visible="true" width="100%"/>
</m:content>
</m:Toolbar>
</m:headerToolbar>
<m:items/>
</m:List>
</m:content>
</m:IconTabFilter>
<m:IconTabFilter icon="sap-icon://attachment" iconColor="Default" text="Attachments" count="" design="Vertical" showAll="false" textDirection="Inherit" enabled="true" visible="true" iconDensityAware="false">
<m:content>
<m:UploadCollection uploadEnabled="false" numberOfAttachmentsText="" showSeparators="All" noDataText="The UploadCollection coming from BUILD cannot work in WebIDE without additional work" maximumFileSize="10" mimeType="image/jpeg,image/gif,image/png,text/plain,application/pdf,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" multiple="false" uploadUrl="" sameFilenameAllowed="false" mode="SingleSelectMaster" uploadComplete="_onUploadCollectionUploadComplete" change="_onUploadCollectionChange" typeMissmatch="_onUploadCollectionTypeMissmatch" fileSizeExceed="_onUploadCollectionFileSizeExceed">
<m:headerParameters/>
<m:items/>
<m:parameters/>
<m:toolbar/>
</m:UploadCollection>
</m:content>
</m:IconTabFilter>
<m:IconTabFilter icon="sap-icon://history" iconColor="Default" text="Protocol" count="" design="Vertical" showAll="false" textDirection="Inherit" enabled="true" visible="true" iconDensityAware="false">
<m:content>
<m:List mode="SingleSelectMaster" width="100%" headerText="Header" footerText="" backgroundDesign="Solid" showSeparators="All" growing="true" growingThreshold="20" growingScrollToLoad="true">
<m:infoToolbar>
<m:Toolbar width="100%" height="auto" design="Auto" visible="false" enabled="true">
<m:content>
<m:Label text="Label" design="Standard" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
</m:content>
</m:Toolbar>
</m:infoToolbar>
<m:headerToolbar>
<m:Toolbar visible="true" enabled="true" width="" design="Solid">
<m:content>
<m:SearchField placeholder="Search" showSearchButton="true" visible="true" width="100%"/>
</m:content>
</m:Toolbar>
</m:headerToolbar>
<m:items/>
</m:List>
</m:content>
</m:IconTabFilter>
</m:items>
</m:IconTabBar>
</layout:content>
</layout:VerticalLayout>
<form:ResponsiveGridLayout columnsM="1" columnsL="2" emptySpanL="0" emptySpanM="0" emptySpanS="0" visible="true" labelSpanS="12" labelSpanM="2" labelSpanL="4"/>
</m:content>
<m:footer>
<m:Bar design="Auto">
<m:contentLeft/>
<m:contentMiddle/>
<m:contentRight>
<m:Button text="Forward" type="Default" iconFirst="true" width="auto" enabled="false" visible="false" iconDensityAware="false" press="_onButtonPress7"/>
<m:Button text="Approve" type="Accept" iconFirst="true" width="auto" enabled="true" visible="true" iconDensityAware="false" press="_onButtonPress8"/>
<m:Button text="Reject" type="Reject" iconFirst="true" width="auto" enabled="true" visible="true" iconDensityAware="false" press="_onButtonPress9"/>
</m:contentRight>
</m:Bar>
</m:footer>
<m:headerContent/>
<m:subHeader/>
</m:Page>
Since I am not a good programmer I am not sure what else you could need, so if there is anything missing, pls let me know.
The question is, that the ObjectHeaders in the Detail view are only refreshed with data once. Furthermore it seems like the fields are only written once, if its empty. After the first time data has been set to a ObjectAttribute field, it is never changed again afterwards.
Why is this? (It is exactly the same problem as mentioned by the referenced Post)