Skip to Content
0
Former Member
Apr 28, 2020 at 09:51 AM

Analytical Table binding

480 Views

Hey together,

I have built an Analytical List Page with Fiori Elements. Well, everything works fine and the app does what it should.

But meanwhile I would like to add an additional filter field. I want to add this filter field with an "extension". This additional field is supposed to be a "DateRangeSelection" and should be predefined with a value.

These code shows the view of the Extension:

<core:FragmentDefinition xmlns="sap.m" xmlns:smartfilterbar="sap.ui.comp.smartfilterbar" xmlns:core="sap.ui.core">
	<smartfilterbar:ControlConfiguration key="CustomFilterBudat" index="1" label="Buchungsdatum" groupId="_BASIC">
		<smartfilterbar:customControl>
			<DateRangeSelection id="budat"/>
		</smartfilterbar:customControl>
	</smartfilterbar:ControlConfiguration>
</core:FragmentDefinition>

These code shows a piece of the controller of the Extension:

onInitSmartFilterBarExtension: function (oEvent) {
		var sUrl = "...";
		var oModel = new sap.ui.model.odata.v2.ODataModel(sUrl, true);
		sap.ui.getCore().setModel(oModel);

		var BUDAT = this.byId("budat");
		var firstDate = BUDAT.setDateValue(new Date("2020-01-01"));
		var secondDate = BUDAT.setSecondDateValue(new Date("2020-12-31"));

		var oFilter = new sap.ui.model.Filter("Buchungsdatum", sap.ui.model.FilterOperator.BT, firstDate, secondDate);

		sap.ui.getCore().byId("budat").bindRows({
			filter: oFilter,
			path: "budat"
		});
	},

The picture shows the predefined field in the App.

It goes all the way to here.

But the filter does not work and the data is not loaded correctly. I think the "bindRows" is wrong. Maybe someone can help.

Thank you and best regards

Tim

Attachments

datepicker.jpg (12.6 kB)