cancel
Showing results for 
Search instead for 
Did you mean: 

SAP UI5 Filter table filter showing wrong data in frontend

pavanm592
Contributor
0 Kudos

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

WouterLemaire
Active Contributor
0 Kudos

Are you sure that the front-end does not receive any records of 2021? Can you share the response of the request (with filter) from the network trace?

Another problem could be that the keys are not unique but in that case you would see dublicates...

pavanm592
Contributor
0 Kudos

Hi c3d1947136cd4c748a7aa794001af496,

I can see the correct year filtered in network tab,but when it is displaying it is showing first record of the table .

2021 05.06.2020 10040
2020 03.06.2020 10041
2020 03.06.2020 10042
for this data when i select 2020 it shows the first 2 rows.In network tab it shows only 2020 records

2020 03.06.2020 10041
2020 03.06.2020 10042
2021 05.06.2020 10040
if the data is sorted this way,then if i select 2020 it is showing correct values,but for 2021 it shows first row in network tab it shows correct record with all 3 key fields

Thanks,

Pavan

WouterLemaire
Active Contributor

What are the keys of this entity in the metadata?

pavanm592
Contributor
0 Kudos

Hi c3d1947136cd4c748a7aa794001af496,

The keys for this entity are Year date and document number .

Regards,

Pavan

maheshpalavalli
Active Contributor
0 Kudos

pavanm592 did you check with the backend team?, it looks like odata is returning you incorrect data..

WouterLemaire
Active Contributor
0 Kudos

Can you check if there are no other errors in the console?

pavanm592
Contributor
0 Kudos

Hi maheshkumar.palavalli,

I've checked the odata filter inn gateway server it is giving expected output. I defined the binding as below.

<Table id="idTable" items="{/EntitySetName}">

In Network tab the batch call is showing the correct data like {"d":{"results": ---} ,the entries shown here are correctly filtered vales but in output it is showing first record of list allways which is not there in the result set.

I didn't found any other errors on console also@c3d1947136cd4c748a7aa794001af496

Regads,

Pavan

WouterLemaire
Active Contributor
0 Kudos

Which version of ui5 are you using?

pavanm592
Contributor
0 Kudos

Hi,

I am using sap-webide-personal-edition-1.53.9-trial-win32.win32.x86_64 and UI5 minimum version is 1.30.0

Thanks

Pavan

Accepted Solutions (0)

Answers (0)