cancel
Showing results for 
Search instead for 
Did you mean: 

How to apply filter before rendering

0 Kudos

Hey,

i'm trying to apply a filter after clicking on a sap.m.Table row.

I click on the row and save a variable of that row in a global attribute.

Then i navigate to another view, that view has another sap.m.Table which i want to filter with the variable i just saved.

Here is my method:

onBeforeRendering: function () {
			Log.info('---------------------------');
			Log.info($.masterID);
			Log.info('---------------------------');
			var aTableSearchState = [];
			var sQuery = $.masterID;
			if (sQuery && sQuery.length > 0) {
				aTableSearchState = [new Filter("master_id", FilterOperator.Contains, sQuery)];
			}
			var oTable = this.byId("table");
			oTable.getBinding("items").filter(aTableSearchState, "Application");

Its giving me the right variable in $.masterID but the filter doesn't work at all

Thanks in advance for any reply!

:

moshenaveh
Community Manager
Community Manager
0 Kudos
Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with https://community.sap.com/resources/questions-and-answers (if you haven't already), as it provides tips for preparing questions that draw responses from our members.
Should you wish, you can revise your question by selecting Actions, then Edit.
Finally, if you're hoping to connect with readers, please consider adding a picture to your profile. Here's how you do it: https://www.youtube.com/watch?v=F5JdUbyjfMA&list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS. By personalizing your profile with a photo of you, you encourage readers to respond.

Accepted Solutions (0)

Answers (1)

Answers (1)

maheshpalavalli
Active Contributor

instead of onbeforerendering, do it in the attachMatched event handler, you can check the example below:

https://ui5.sap.com/#/topic/f96d2522a5ca4382a274ae3c6d002ca0

-Mahesh