Getting Duplicate Data in DropDownDataGrid

Hello,

I have a list of Employees that I populate a drop down datagrid with. I can search for the employees and select them, but when I do I get multiple of the same employee (as Chips). As you can see here I search for 'doe' and get one John Doe result, but two Chips after I click on it (note: I cannot delete/deselect any of the Chips):

image


image

For the dropdown datagrid component I supplied the Value - SelectedRecipients - from a partial class:

namespace ThankTank.Models.Sqlcluster
{
public partial class TblThankTank
{
[NotMapped]
public IEnumerable SelectedRecipients
{
get{
return !string.IsNullOrEmpty(Recipients) ? Recipients.Split(',').Select(x => x.Trim().ToUpper()).Distinct() : Enumerable.Empty();
}
set{
Recipients = string.Join(",", value);
}
}
}
}

I tried to filter only unique values from the code above, but the component appears to call the Get method twice for some reason. Is this a bug or do I need to change my approach here?

Thanks,

Bill

Hi @bdiplacido,

Please check if your Data does not contain employees with duplicated names. I'm afraid that I've never seen such issue before and I don't know how to reproduce it.

Hi @enchev,

I ran a couple queries to verify that there are no duplicates:

select COUNT(UserName) from [dbo].[v_Employees]
--177
select COUNT(distinct UserName) from [dbo].[v_Employees]
--177

What's interesting is that the same thing happens on the regular DropDown component, but only if I perform a search (filter). If I just pick an employee with the regular DropDown component without performing a search everything works as expected.

Thanks,

Bill

Hi @bdiplacido,

According to your queries in the last post it seems that you are using views. This article might be relevant:

Hi @enchev,

Yes, we were using a view to access the employee directory. After switching it to the underlying table instead, everything works as expected!

Thanks!

Bill