Skip to Content
avatar image
Former Member

OData v4 filtering does not work in sapui5

Hi folks,

I am trying to count the number of rows with specific value in "firstName" column, in OData v4. After googling I found out that I can't use the read function or doing this through ajax in Odata v4, so I decided to bind the items with filtered value to a table and count the number of items in table. To do so, I used the following codes in sapui5. Unfortunately, filtering does not work and I get all the items in my table not just the filtered items. Any Idea?


<Table id="booksTable" width="auto" inset="false">
	  <Text text="order Number"/> 
	<Column demandPopin="true" minScreenWidth="Tablet"> 
	  <Text text="First Name"/> 
	  <Text text="Price"/> 
  <ColumnListItem id="columnListItem"> 
	  <ObjectIdentifier title="" text="{ordersModel>orderNo}"/> 
		<Text text="{ordersModel>firstName}"/> 
	<ObjectNumber unit="{ordersModel>orderCurrency}" number="{ parts:[{path:'ordersModel>orderAmount'},{path:'ordersModel>orderCurrency'}], type: 'sap.ui.model.type.Currency', formatOptions: {showMeasure: false} }"/> 

In JS:

], function(Controller, Filter, FilterOperator, JSONModel) {
	"use strict";

	return Controller.extend("KPI.ui.controller.KPIview", {
		onInit: function() {
                    this._oView = this.getView();
			this._oItemsTable = this.byId("booksTable");
			this._oItemTemplate = this.byId("columnListItem").clone();

			    path : "ordersModel>/Orders",
			    parameters : {
			        filter : "firstName eq 'Samin'",
			        select : ["orderNo","firstName","orderCurrency","orderAmount"]
			    template: this._oItemTemplate

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers