cancel
Showing results for 
Search instead for 
Did you mean: 

SAP UI5 Treetable Data Filtering

02-05-2020 6:25 PM
emil_lazarski Explorer
980 views 0 comments
0 Likes
SAP Managed Tags
Subscribe

Hi,

I have an interesting issue which is bothering me a lot:

I have created the XML View with the TreeTable in it, additionally this view contains a SearchBox. What I was trying to achieve was to enable filtering the results. I am using WEB IDE.

The code for filtering is pretty straightforward:

var oTable = this.byId("Tree");
var oModel = oTable.getModel();
var oFilter = new sap.ui.model.Filter("EntityID", sap.ui.model.FilterOperator.EQ, searchString);
oModel.read("/HierarchyObjectSet", { filters: [oFilter], success: this.onResult });

When I am checking the result (oData of the success) I receive the filtered values (which is ok)

onResult: function (oData, response)

It comes after the backend code is performed (GetEntitySet).

However, the return of the correct data does not mean that the TreeTable has changed values.

I tried to use:

but the tree was null and hence I could not access the TreeTable and modify it’s model.

Could you tell me what am I doing wrong?

Btw. I tried even writing something like this:

 var list = this.getView().byId("Tree");
 var binding = list.getBinding(); binding.filter(oFilter);

Just after oModel.read

which did not give any results.

Thank you in advance!

0 Likes

Accepted Solutions (0)

Answers (0)