Populating SelectFilter with relation.
I have a belongsTo relation between my StudentProfile and my User model. From the StudentProfile resource I'm trying to populate a SelectFilter with available courseClasses. The courseClass has a belongsTo with the User.
My selectfilter is setup like this:
This however, populates the select filter with all available class id's from the student resource. This way I have duplicates and also selecting one ID just filters one user. What would be the correct approach?
3 Replies
What are you trying to show in the filter exactly? All classes or just the classes for this specific student?
I would like to select one class in my filter and get all students in it. In my current setup, I have e.g. 10 students in class "a" and 5 students in class "b". My filter is populated with 10 x 'a' and 5 x 'b'. Each filter selection just shows one student as result.
I see, makes sense. Can you share a bit more information on how the relationships are setup in your models?