Disable multiselect options

I have a table that displays data. Specifically, employee_ids.
When I select a row in the table component, an employee_ids field in a form will be populated with the employee_ids from the selected row data.
The employee_ids field is populated correctly.
But here is what I want to do...

  1. Allow user to remove employee_ids in the record. (This works)
  2. Allow user to select other employee_ids BUT only employee_ids that are not already contained within the table component itself. In other words, if employee_ids exist in one row in the table component, they cannot be added to another row.

I have tried to Disable the option in the multi-select component from being selected using the following logic:
{{teamTable.data.employee_ids[i].includes(item.employee_id)}}
but this results in only Disabling the first option in the multi-select (which causes #1 above not to work.)
I also tried {{_.includes(teamTable.data.employee_ids[i], item.employee_id)}} but no luck.
Any help greatly appreciated!

Here is what the array of employee_ids looks like


then only getting the first array
Screenshot 2023-05-24 at 2.24.51 PM
then the first ID in the first array
Screenshot 2023-05-24 at 2.25.02 PM
So even when attempting to iterate in the Disabled field using [i][i] like so:
{{_.includes(teamTable.data.employee_ids[i][i], item.employee_id)}}
Screenshot 2023-05-24 at 2.27.11 PM
It does not work.

If I'm guessing correctly you are trying to exclude items from teamTable.data.employee_ids which is a multi-dimensional array. For disable you need to return a Boolean value true/false so that means you need to turn that multi-dimensional array into a single array and exclude based on it.

I'll provide an example hope it helps!

@stefancvrkotic
Here is what the component looks like