Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
zygimantus opened this issue Feb 20, 2020 · 17 comments
Closed

Comments

@zygimantus
Copy link

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
Copy link
Contributor

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
Copy link
Author

Thank you @NHristov-sap.

@HerzogIgzorn
Copy link
Contributor

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
Copy link
Author

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
Copy link
Member

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
Copy link
Member

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

@balasubramaniyammurgan
Copy link

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
Copy link

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
Copy link
Member

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
Copy link

@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 RandomByte reopened this Dec 6, 2022
@RandomByte
Copy link
Member

Tracking internally as 2280186931

@HannaNguyen-new
Copy link

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

@uhlmannm
Copy link
Member

uhlmannm commented Jan 2, 2023

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
Copy link

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
Copy link
Member

uhlmannm commented Jan 5, 2023

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
Copy link

@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
Copy link
Member

SvBe commented May 8, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants