Issue with editing custom filters with Dynamic Attributes

I am experiencing a strange issue with grid filters that reference Dynamic Attributes. The filter I am creating uses two Dynamic Attributes from the entity I am searching on and one Dynamic Attribute from a related entity. The first issue I am having is that when selecting the second attribute from the current entity it sometimes changes the first attribute I chose as well leaving me with two filter parameters pointing to the same attribute. I can usually correct this by editing the filter and changing one of the attributes back to the original value. The bigger issue is that once I add in the Dynamic Attribute from the related entity every time I open the filter editor it seems to loose the settings on the attribute parameter. The Category, Attribute, and Operation fields are all empty. When I try and select the category again, the drop down only lists the categories of my current entity not the categories of the related entity in which I am trying to use. I am forced to delete the parameter and re-add it.

Can you please create a small demo project where this problem can be reproduced and describe a sequence of steps to reproduce the problem.

You can use the “zipProject” gradle task - it will create an archive of the project and HSQL database with the data.

I have attached a slightly modified version of the Order Management demo. Perform the following steps to reproduce the issue:

  1. Create a new Category (Under the Administration -> Dynamic Attributes screen) for Product called “Toy”
  2. Create an Attribute with the name Color for the Toy Category. Set the type to Enumeration and define a couple of values.
  3. Create another Attribute with the name Material for the Toy Category. Again set the type to Enumeration and supply a few enum values.
  4. Click Ok on the Attribute screen to go back to the list of Categories. Click Apply Changes.
  5. Add a new Category for Product called “Book”.
  6. Click Ok on the Attribute screen to go back to the list of Categories. Click Apply Changes.
  7. Open the Product Browser
  8. Create a new Filter.
  9. Edit the filter
  10. Click the Add button to add a new condition
  11. Select Dynamic Attribute
  12. Select the Toy Category
  13. Select the Color Attribute
  14. Select the “=” operation
  15. Click OK
  16. Repeat steps 4 – 9 but selecting the Material Attribute for the same Toy Category.
  17. You will notice that even though the Material condition is selected the editor on the right shows the Attribute of Color. If you select the Color condition the Material condition renames itself to Color, leaving you with two Color conditions.

I’ve noticed this behavior does not occur until there is more than one Category defined for the Entity. This same behavior is also extended to custom conditions in which a join to another table is defined but only once the steps above have been completed.