Hi, I would like to know if there is a way to stack selected Items vertically rather than the horizontal stack and showing "+n More" for comma delimiter mode. I am after something like how the ListBox show the selected items for the Multiselect Dropdown as well. Basically I would like to see all the selected items stacked vertically without having to click the control possibly with a scroll bar on its side as well. Is this possible?
Thanks,
Harry
<SfMultiSelect TValue="string[]" TItem="EmployeeData" ClosePopupOnSelect="false" HideSelectedItem="false" @bind-Value="@MultiVal" Mode="VisualMode.Box" Placeholder="Select a customer" DataSource="@Data">
<MultiSelectEvents TValue="string[]" TItem="EmployeeData" OnValueSelect="onSelect"></MultiSelectEvents>
<MultiSelectFieldSettings Value="FirstName"></MultiSelectFieldSettings>
</SfMultiSelect> |
|
Hi Ponmani,
Thank you very much for getting back to me. However, I am more after listing each selected item comma delimited (without the colored grey box) and one item per row. Is this possible?
Thanks.
<SfMultiSelect TValue="string[]" Width="300px" TItem="GameFields" Mode="@VisualMode.Box" Placeholder="Favorite Sports" DataSource="@Games">
<MultiSelectFieldSettings Text="Text" Value="ID"></MultiSelectFieldSettings>
</SfMultiSelect>
@code{
public class GameFields
{
public string ID { get; set; }
public string Text { get; set; }
}
private List<GameFields> Games = new List<GameFields>()
{
new GameFields(){ ID= "Game1", Text= "American Football" },
new GameFields(){ ID= "Game2", Text= "Badminton" },
new GameFields(){ ID= "Game3", Text= "Basketball" },
new GameFields(){ ID= "Game4", Text= "Cricket" },
new GameFields(){ ID= "Game5", Text= "Football" },
new GameFields(){ ID= "Game6", Text= "Golf" },
new GameFields(){ ID= "Game7", Text= "Hockey" },
new GameFields(){ ID= "Game8", Text= "Rugby"},
new GameFields(){ ID= "Game9", Text= "Snooker" },
new GameFields(){ ID= "Game10", Text= "Tennis"}
};
}
<style>
.e-multi-select-wrapper .e-chips-collection {
display: grid;
}
.e-multi-select-wrapper .e-chips {
background-color: white;
}
.e-multi-select-wrapper .e-chips > .e-chipcontent {
-webkit-text-fill-color: black;
}
.e-multi-select-wrapper .e-chips .e-chips-close::before {
-webkit-text-fill-color: #170606;
}
.e-multi-select-wrapper .e-chips:hover {
background-color: white;
}
.e-multi-select-wrapper .e-chips.e-chip-selected:hover {
background-color: white;
}
.e-multi-select-wrapper .e-chips.e-chip-selected {
background-color: white;
}
</style> |
|
Hi Ponmani,
Thank you so much for your reply. Although this partially fixes my issue, I need the Multiselect Dropdown Mode to be "VisualMode.CheckBox". With your example I can stack the selections but cannot select multiple items at once without contracting the drop down menu. I need the Multiselect box to be as below so I can click "Select All" or select multiple items without closing the dropdown menu. Is it possible?
Thank you very much.
<SfMultiSelect @ref="MultiObj" TValue="string[]" TItem="EmployeeData" ClosePopupOnSelect="false" HideSelectedItem="false" @bind-Value="@MultiVal" Mode="Syncfusion.Blazor.DropDowns.VisualMode.Box" Placeholder="Select a customer" DataSource="@Data">
<MultiSelectTemplates TItem="EmployeeData">
<HeaderTemplate>
@{
<span>
<SfCheckBox TChecked="bool" @bind-Checked="isChecked" @onclick="onClick" >SelectAll</SfCheckBox>
</span>
}
</HeaderTemplate>
<ItemTemplate>
@{
var contextValue = (context as EmployeeData).FirstName;
bool isChecked = MultiVal != null ? MultiVal.Contains(contextValue) : false;
<span>
<SfCheckBox TChecked="bool" @bind-checked="@isChecked"></SfCheckBox>
@contextValue
</span>
}
</ItemTemplate>
</MultiSelectTemplates>
<MultiSelectEvents TValue="string[]" TItem="EmployeeData" OnValueSelect="onSelect"></MultiSelectEvents>
<MultiSelectFieldSettings Value="FirstName"></MultiSelectFieldSettings>
</SfMultiSelect> |
private bool isChecked = false;
private async Task onClick(Microsoft.AspNetCore.Components.Web.MouseEventArgs args)
{
if (isChecked == false)
{
isChecked = true;
MultiVal = new string[] { "Andrew Fuller", "Anne Dodsworth", "Janet Leverling", "Laura Callahan", "Margaret Peacock" };
}
else
{
isChecked = false;
MultiVal = new string[] { };
}
}
} |
|
Hi Ponmani,
Thank you for getting back to me. Very clever to change the styles and make it stack the selected items vertically. Although, by doing this I lose the Filter functionality. This is a must when using the multiselect dropdown because there will be many items to choose from.
Also when the selected items get stacked, the text field grows downward. Is there a way to make it fixed and add a scrollbar instead?
Thanks,
Harry
<SfMultiSelect @ref="MultiObj" TValue="string[]" TItem="EmployeeData" ClosePopupOnSelect="false" AllowFiltering="true" HideSelectedItem="false" @bind-Value="@MultiVal" Mode="Syncfusion.Blazor.DropDowns.VisualMode.Box" Placeholder="Select a customer" DataSource="@Data">
|
.e-multi-select-wrapper {
height: 100px;
overflow: overlay;
} |
Hi Ponmani,
Thank you so much for this. However, there is a small issue when this is tested with Firefox browser. The selected text outgrows the border as below..
Hi Ponmani,
I was able to fix the above mentioned issue by changing it to "Overflow: scroll". Thank you very much for the effort that you've put in to providing me this solution.
Harry.