I’m trying to filter a 1 to many (Set) of Objects from an AutoCRUD component. However, I can’t seem to be able to display any header filter for that column.
Hey @L_B,
Welcome to the forum and thank you for reading my blog post
Can you tell me something about your entities? What attributes does your entity Owner have? And what is the name of the entity, that has the attribute labels?
The 1:n relation in the blog post is: 1 order has 1 customer and 1 customer can have 0, 1 ore multiple orders. How is the relationship in your application?
I haven’t tried to use a custom render for a OneToMany relationship, but I guess it should work. Check the matcher and @type properties in your setFilter function, because they indicate that labels is a String, but in your example labels is a Set.
Let’s assume it’s a ManyToOne then for the sake of the argument. So changing the type is ‘@type’: ‘propertyString’, to indicate the filter to be a string value, or am I mistaken? I tried changing it to ‘@type’: ‘propertySet’, and no filter show up still.
And the matcher property is “CONTAINS” like in your example. Would you change it?
The code in the blog post is based on 24.4.0.beta1.
You should try and change the property propertyId in your setFilter function to labels.value, because you want to compare the value field and not the whole Label object.
But this won’t solve your problem, that you don’t see any header filter for that column… Beside the missing header filter, do you see the labels in this column?
I see a @ts-ignore in your code. What is the problem there?
It uses the latest beta version. Have a look at src/main/frontend/views/@index.tsx to see an AutoCrud component displaying a list of labels.
I’ve noticed that there are some problems using the MultiSelectComboBox component inside the form to render the labels. Sometimes it displays the selected labels and sometimes it creates an error. I couldn’t reproduce it correctly yet…