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

Error when overriding datasource filters in inherited screen #3274

Open
vao-igel opened this issue Jun 7, 2022 · 3 comments
Open

Error when overriding datasource filters in inherited screen #3274

vao-igel opened this issue Jun 7, 2022 · 3 comments

Comments

@vao-igel
Copy link

vao-igel commented Jun 7, 2022

Platform version: 6.10.17

Steps to reproduce:

  1. Create browser screen with collectionDatasource, add filter to this datasource with structure:
<filter>
 <and>
  <c>some filter expression</c>
 </and>
</filter>

Filter must contain exactly one <c> element. If it has two or more the bug does not occur.

  1. Create screen inherited from the first one, override the filter for the same datasource by adding several elements:
<filter>
 <and>
  <c>expression1</c>
  <c>expression2</c>
  <c>expression3</c>
 </and>
</filter>

When running and debugging the loading phase of the datasource of the overridden screen it is seen that only the last filter expression is present in filter. I found that this error originates in the class XmlInheritanceProcessor in method "private void process(Element resultElem, Element extElem)" at lines 153-158: if the element from base screen has only one child (not affected by any locator) then all the children of the same element from inherited screen will be merged into it by method "private void process(Element resultElem, Element extElem)". Using attribute "ext:index" does not help. The only way to avoid this behavior is create two filter expressions in base screen.
Maybe it can be fixed by adding the element "list.get(0)" to "justAdded" collection after line 155.

@gorbunkov
Copy link
Contributor

It works like it is described in the documentation:

Otherwise, the platform determines how many elements with the provided path and name are contained in the parent descriptor. If there is only one element, it is overridden.

I think you can try adding different id attributes to the <c> tag in original and extended screens. If these elements have ids, they won't be overriden.

@vao-igel
Copy link
Author

When I put 2 or 3 <c> elements in extended screen they do not just override the initial single <c> element, they all collapses into one in the result screen description. I don't think that this is a correct behavior.

@gorbunkov
Copy link
Contributor

they all collapses into one in the result screen description

Could you provide an example? I don't get what do you mean by all element collapses into one.

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

No branches or pull requests

2 participants