Skip to Content
0
May 20, 2020 at 09:03 AM

Missing table template on back and forth navigation

80 Views Last edit May 20, 2020 at 09:06 AM 3 rev

Hello experts,

I am trying to build an application that has table#1 with clickable items and display data in another view with table#2 depending on which item you clicked in the first table.

This is some weird behaviour and I'll try to explain the problem the best I can:

The application works fine the first time you use it - I click an Item in table#1 -> it navigates to the view with table#2 and displays the dependent data. Everything works perfectly fine.

Now if i navigate back to table#1 and click another item, it loads table#2 but without any data.

The third time (and every time after that) I navigate back and click an item in table #1 and table#2 is supposed to load I get the error message :

"Error: Missing template or factory function for aggregation items of Element sap.m.Table"

I have tried reloading the item aggregation, destroying the template on navigation, reloading model data and setting the templateSharable flag to true / false but nothing helped in any way.

I'm posting the relevant code for the view with table #2 below

My XML Code:

<f:SimpleForm id="simpleform" editable="true" layout="ResponsiveGridLayout">
	<f:content>
		<semantic:SemanticPage id="page" headerPinnable="false" toggleHeaderOnTitleClick="false" >
			<semantic:content id="posContent">
				<Table 
				id="rkDetailTable"
				noDataText="{i18n>tableNoDataText}"
				>
					<columns>
						<Column>
							<Text text="Pos ID"/>
						</Column>
						<Column>
							<Text text="{i18n>Art_RkDetail}" />
						</Column>
						<Column>
							<Text text="{i18n>Betrag_RkDetail}"/>
						</Column>
					</columns>
					<items>
						<ColumnListItem id="rkDetailTableTemplate" type="Navigation" press="onDetail">
							<cells>
								<ObjectIdentifier title="{RkposId}" />
								<Text text="{RksatzId}" />
								<ObjectNumber number="{RkposBetrag}" unit="EUR" />
							</cells>
						</ColumnListItem>
					</items>
				</Table>
			</semantic:content>
		</semantic:SemanticPage>
	</f:content>
</f:SimpleForm>

The corresponding controller:

onInit: function () {	
	this.getRouter().getRoute("RkItemDetail").attachMatched(this.onRouteMatched, this);
},
onRouteMatched: function (oEvent) {
	var oArguments = oEvent.getParameter("arguments");
	var RkId = oArguments.RkId;


	var sBindingPathAbrechnung = "/AbrechnungSet(" + RkId + (")");
	this.getView().byId("simpleform").bindElement(sBindingPathAbrechnung); 


	var sBindingPathPosition = "/AbrechnungSet(" + RkId + (")/ToPos");
	this.byId("rkDetailTable").bindItems({
		path: sBindingPathPosition,
		template: this.byId("rkDetailTableTemplate"),
		templateShareable: true
	});
}

Disregard the element binding, it is used for something else in that view.

Thanks,

Mathias