SAP / openui5

OpenUI5 lets you build enterprise-ready web applications, responsive to all devices, running on almost any browser of your choice.
http://openui5.org
Apache License 2.0
2.96k stars 1.24k forks source link

When doing search in TreeTable HIERARCHY_LEVEL eq 0 is added automatically #2818

Closed zygimantus closed 1 year ago

zygimantus commented 4 years ago

I am facing a issue with a TreeTable. Suppose I have a following rows binding:

rows="{ path : '/MY_TABLE', parameters : { countMode: 'Inline', treeAnnotationProperties : { hierarchyLevelFor : 'HIERARCHY_LEVEL', hierarchyNodeFor : 'HIERARCHY_RANK', hierarchyParentNodeFor : 'HIERARCHY_PARENT_RANK', hierarchyDrillStateFor : 'DRILL_STATE' } } }"

If I am doing a search in this grid table on a back-end, it seems that HIERARCHY_LEVEL eq 0 is added automatically. Is there a way to modify this sap.ui.model.odata.v2.ODataTreeBinding functionality?

NHristov-sap commented 4 years ago

Hello @zygimantus,

Thank you for sharing this finding. I've created an internal incident 2070018176. The status of the issue will be updated here in GitHub.

Regards, Nikolay Hristov GitHub Dispatcher

zygimantus commented 4 years ago

Thank you @NHristov-sap.

HerzogIgzorn commented 4 years ago

Hello zygimantus,

can you provide more details on this issue? How exactly are you searching on the backend? Do you add a filter on the binding? Can you provide a sample where we can debug this issue?

Regards Sebastian

zygimantus commented 4 years ago

Hello, @HerzogIgzorn , yes, I am using a custom filter function via filter property on TreeTable which in the end filters like this: oTable.getBinding("rows").filter(oFilter, "Application"); Not sure if I would manage to provide a sample because it would require to host somehow odata service.

RandomByte commented 4 years ago

Hi @zygimantus, I would expect that almost all request from this TreeTable filter on the hierarchy level. This is by design.

What issue are you facing with this behavior? How would you like to change it?

Relevant documentation: https://ui5.sap.com/#/api/sap.ui.model.odata.v2.ODataTreeBinding%23overview

RandomByte commented 4 years ago

Closing due to inactivity. Please feel free to comment if there's new input.

balasubramaniyammurgan commented 2 years ago

I am also facing the hierarchy level issue as 0 by default filter is going to backend when i am doing a filter

HannaNguyen-new commented 1 year ago

Hi @zygimantus, I would expect that almost all request from this TreeTable filter on the hierarchy level. This is by design.

What issue are you facing with this behavior? How would you like to change it?

Relevant documentation: https://ui5.sap.com/#/api/sap.ui.model.odata.v2.ODataTreeBinding%23overview

@RandomByte This works nice for initial display of the table. The problem is when I want to filter with certain keywords (for example, 'name startsWith B') without considering hierarchy level , hierarchyLevel eq 0 (or rootLevel) is automatically added to the request sent to backend odata service. Is there a way to remove this deafault hierarchyLevel filter?

ThomasChadzelek commented 1 year ago

Hello!

I am currently working on the OData V4 "TreeBinding" and thus would like to learn from the past. I did not really understand which negative effect this hierarchyLevel eq 0 has on the request (or response, probably)? Can you please elaborate a bit more?

Best regards, Thomas

HannaNguyen-new commented 1 year ago

@ThomasChadzelek
Hi, thank you for your quick reply. In my case, I bind TreeTable with OData V2 (operationMode SERVER) and rootLevel set to 1. After initial display (here only data of hierarchyLevel eq 1 is displayed), the requirement is to be able to filter this table with search keywords. I use this syntax to filter but there are no results. oTreeTbl.getBinding("rows").filter(oMyFilter, FilterType.Application)

When I checked the network tab, the request was in this format (url-decoded) $filter=hierarchyLevel eq 1 and (substringof('searchKeyword', description)) hierarchyLevel was added automatically, thus resulting in wrong filter.

Is it possible to remove this default filter?

RandomByte commented 1 year ago

Tracking internally as 2280186931

HannaNguyen-new commented 1 year ago

Is this issue being fixed? May I ask the expected date of release?

uhlmannm commented 1 year ago

Hi @HannaNguyen-new,

Is this issue being fixed? May I ask the expected date of release?

No, we are not even sure whether it is an issue on the client or server side. We need to investigate an example. To that end we had contacted a colleague by the same name as you. So far without a result.

What we can do here is to double-check expectations. We are displaying a hierarchy. When filtering or searching, the expectation is that all nodes matching the filter/search and all parents of these matching nodes are forming the hierarchy. It would then be possible to request level 0 and get all the matching nodes in level 0 plus all parents of matching nodes in level 0.

Is that also your expectation? Is that also how your service behaves?

Best regards Mathias.

HannaNguyen-new commented 1 year ago

Hi, @uhlmannm In our case, this is an issue on client side because the request is sent with hierarchyLevel eq 0 (rootLevel is 1 in our case though). the expectation is that all nodes matching the filter/search and all parents of these matching nodes are forming the hierarchy -> Our application uses sap.ui.table.TreeTable and I suppose this is what sap.ui.table.TreeTable expects to get. Our application returns results satisfying this condition so as to form hierarchical structure( We use CAP java handlers to deal with this). Matching nodes are not necessarily in level 0 (or root level). Therefore, except for initial display, I think this default query is not necessary. $filter=hierarchyLevel eq 1 and

uhlmannm commented 1 year ago

Hi Hanna,

as written before, we need to analyze what is happening with an example. Please provide an example! Also, if you are working for SAP, I strongly encourage you to contact me internally, as this makes organizing the analysis much easier.

Best regards Mathias.

HannaNguyen-new commented 1 year ago

@uhlmannm I'm not working for SAP, our team is developing an app using SAP technologies. It might take some time but I'll try providing a sample.

SvBe commented 1 year ago

Hello, I was able to have a deeper look at this issue. If you are using tree tables as mentioned above, the underlying tree binding requests the data. First all elements of the root level are requested. So the binding creates a request with the filter HIERARCHY_LEVEL eq 0 (as in the example above; other levels are also possible, for example 1 as decribed by HannaNguyen-new). If the application now filters for any other property, the tree structure must not be corrupted, that means all parent nodes for the matches have to be contained in the result. In the example above, $filter=hierarchyLevel eq 1 and (substringof('searchKeyword', description)), the backend service has to apply the non-tree-structural filters substringof('searchKeyword', description) first. The result has to contain all parent nodes up to the root for all matches. After that the filters for tree-structural properties have to be applied (for example hierarchyLevel eq 1), which filters the root elements of all matching results. That's the expected response for this request. This is the way how TreeBindings work.

Best Regards, Sven