need validation to avoid picking same user multiple times when we trying to add a row in editable grid
Discussion posts and replies are publicly visible
OK. What did you try so far?
One option could be to compare the number of items it the assignees list to the number of items in the union of the assignees list. in pseudo-code, this could look like this.
count(assignees) = count(union(assignees, assignees))
This does not prevent duplicates, but only limits the amount of chosen options to the amount of unique available options.
I suggest a validation for each chosen value that checks for multi-presence in the list of chosen values, using the count on wherecointains(). Note: depending on the implementation, this approach can be heavy for large volumes.
is there any alternative method....? can't we make it using union function...?
This is the logic I pointed out. You can then use it for validations on the user picker fields.