I have the following SfMultiSelect with its DataSource set to a List<KeyValuePair<int, string>>.
<SfMultiSelect TValue="int[]"
TItem="KeyValuePair<int, string>"
Mode="@VisualMode.Box"
AllowFiltering="true"
ShowSelectAll="true"
ShowDropDownIcon="true"
EnableSelectionOrder="true"
EnableCloseOnSelect="false"
Placeholder="@localizer[Resources.App.DaysOfWeek]"
FloatLabelType="FloatLabelType.Always"
DataSource="@daysOfWeek"
@bind-Value="@recurringJob.SelectedDaysOfWeek"
Enabled="@(!recurringJob.EveryDayOfWeek)">
<MultiSelectFieldSettings Text="@nameof(KeyValuePair<int, string>.Value)"
Value="@nameof(KeyValuePair<int, string>.Key)">
</MultiSelectFieldSettings>
</SfMultiSelect>
@code {
private List<KeyValuePair<int, string>> daysOfWeek = new();
}
recurringJob.SelecteDaysOfWeek is defined as:
[NotMapped]
public int[] SelectedDaysOfWeek
{
get => string.IsNullOrWhiteSpace(this.CronDaysOfWeek)
? new int[0]
: this.CronDaysOfWeek.Split(',').Select(x => Convert.ToInt32(x)).ToArray();
set => this.CronDaysOfWeek = string.Join(",", value);
}
Everything works fine initially and I'm able to select multiple items.
But when I open the record back up only the first item that was selected is still selected.
I've confirmed through debugging in the BeginEdit Action RequestType that the recurringJob.SelectedDaysOfWeek array contains all three values.
I think it has something to do with using the KeyValuePair generic class. If I create a simple class with an int and string property it works fine.
Also, note the positioning of the label. As I select more items and the list gets taller, the label moves down.
Thanks,
Craig
Hi Craig,
Currently, we are validating on your reported query. we will update you the further details in two business days on or before 20th January 2022.
Regards,
Vinitha