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:
- Create a new Category (Under the Administration -> Dynamic Attributes screen) for Product called “Toy”
- Create an Attribute with the name Color for the Toy Category. Set the type to Enumeration and define a couple of values.
- Create another Attribute with the name Material for the Toy Category. Again set the type to Enumeration and supply a few enum values.
- Click Ok on the Attribute screen to go back to the list of Categories. Click Apply Changes.
- Add a new Category for Product called “Book”.
- Click Ok on the Attribute screen to go back to the list of Categories. Click Apply Changes.
- Open the Product Browser
- Create a new Filter.
- Edit the filter
- Click the Add button to add a new condition
- Select Dynamic Attribute
- Select the Toy Category
- Select the Color Attribute
- Select the “=” operation
- Click OK
- Repeat steps 4 – 9 but selecting the Material Attribute for the same Toy Category.
- 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.