Hi guys! I am hoping someone can chime in with some thoughts about solving a use case I've never had before.
Let's say I have a "schedule" for a user. the schedule datasource has a foreign key to user like so:
So, in my schedule tab, I have a list grid to the left, that lists all existing schedules. You can add, edit remove a schedule item for a user. A user might have a schedule, but if the user does, there is only ONE row. (i.e. unique constraint on userId column)
The "schedule" form is regular, i.e. a bunch of fields, and a ComboboxItem for the users list.
Now, that list will contains all users returned by the datasource, as per normal as well.
However, what I'm trying to do, is to filter that list based on already existing schedules. I.e. when a new schedule is to be created, the dropdown should only contain the items that are NOT already in the grid.
I could of course use operationId, and have a custom server-side fetch to populate the dropdown. However, that would mean that I'd have to re-fetch it from the server every time a schedule is added or removed.
---
I was thinking that I could do this client-side, by using a ondataarrivedhandler on the grid, store them away in an array. Then I could filter the items in the select item based on the data in the list grid every Time the user presses "add".
So, basically, my question is, am I looking at this wrong way? is there a better approach to handle this, perhaps by using some sort of filtering mechanism I've missed?
Thankful for pointers.
Let's say I have a "schedule" for a user. the schedule datasource has a foreign key to user like so:
Code:
<field name="reporterId" type="integer" title="Användare" foreignKey="user.id" required="true" combo="true"/>
The "schedule" form is regular, i.e. a bunch of fields, and a ComboboxItem for the users list.
Now, that list will contains all users returned by the datasource, as per normal as well.
However, what I'm trying to do, is to filter that list based on already existing schedules. I.e. when a new schedule is to be created, the dropdown should only contain the items that are NOT already in the grid.
I could of course use operationId, and have a custom server-side fetch to populate the dropdown. However, that would mean that I'd have to re-fetch it from the server every time a schedule is added or removed.
---
I was thinking that I could do this client-side, by using a ondataarrivedhandler on the grid, store them away in an array. Then I could filter the items in the select item based on the data in the list grid every Time the user presses "add".
So, basically, my question is, am I looking at this wrong way? is there a better approach to handle this, perhaps by using some sort of filtering mechanism I've missed?
Thankful for pointers.
Comment