Skip to Content
0
Jun 04, 2020 at 03:09 PM

SAP UI5 Filter table filter showing wrong data in frontend

1024 Views

Hi All,

I am displaying some data in table and had a ComboBox element which has years in a seperate entity set binded to it. initally all the data is displyed in table for the user when a year is selected in the Combobox i am filtering the table data as below .

var oTable = this.getView().byId("idTable");
var oFilter = new sap.ui.model.Filter("Zyear", sap.ui.model.FilterOperator.EQ, this.selYear);
 oTable.getBinding("items").filter(oFilter);

here the idTable has 3 key fields in odata and the data is filtered correctly in backend ,but in front end the result is shown differently . for ex. if i select an year 2020 after the filter output in table is showing 2020 and 2021 record .

	<Toolbar>
		<ComboBox items="{/Year}" id="idComb"  selectionChange="OnYear">
					<core:Item text="{Zyear}"/>
				</ComboBox>
				<ToolbarSpacer/>
			</Toolbar>
			<Table id="idTable" items="{/IT_itemset}">
				<columns>
					<Column visible="false"><Text text="PO Number"/> </Column>
					<Column><Text text="{i18n>Date}"/></Column>
					<Column><Text text="{i18n>Year}"/></Column>
				</columns>
                            <ColumnListItem>
                              <cells>
                               <Text text="{Ponum}"/>
                               <Text text="{Zyear}"/>
                               <Text text="{Date}"/>
                               
                              </cells>
                            </ColumnListItem>

How can we active the filter option on this table as both table and combobox are having differnt entitysets binded ,do we need to pass all 3 key fileds on filter .

Thanks,

Pavan