How to select a chip
Hi
I have this code to build the chiplist.
<EjsChipList Selection="Selection.Multiple" Text="Treatments" CssClass="e-outline">
<ChipCollection>
@foreach (var treatment in ReservationRequest.Treatments)
{
<ChipListChip Text="@treatment.Description" Enabled="true"></ChipListChip>
}
</ChipCollection>
<ChipListEvents OnClick="OnTreatmentClicked"></ChipListEvents>
</EjsChipList>
I don't see any "Selected" property in the ChipListChip, so how can I select a chip?
Best Regards
Raymond
SIGN IN To post a reply.
3 Replies
SP
Sowmiya Padmanaban
Syncfusion Team
February 27, 2020 08:49 AM UTC
Hi Raymond,
Greetings from Syncfusion support.
We have checked your reported problem. In Chip component, we have SelectedChips property. Using this property, you can able to select the chip item.
Refer the below code snippet.
|
<EjsChipList SelectedChips="@selectedChip">
<ChipCollection>
@for (int i = 1; i <= ChipData.Count; i++)
{
}
</ChipCollection>
</EjsChipList>
@code{
public List<ChipCollection> ChipData = new List<ChipCollection>();
public object selectedChip { get; set; } = new int[] { 1, 3 };
}
|
For your reference, we have prepared a sample.
To know more about the Chip component. Refer the below links.
UG Documentation – https://ej2.syncfusion.com/blazor/documentation/chip/getting-started/
Please let us know, if need any further assistance.
Regards,
Sowmiya.P
RA
Raymond
February 27, 2020 10:28 AM UTC
Hi, thanks for the answer
How do I figure out these things on my own so I don't have to ask? For example, how do I know that SelectedChips property can be bound to an integer array.
In the link: https://help.syncfusion.com/cr/blazor/Syncfusion.EJ2.Blazor.Buttons.IChipList.html it just says:
object SelectedChips {get; set;}
Best Regards
Raymond
SA
Shameer Ali Baig Sulaiman Ali Baig
Syncfusion Team
February 27, 2020 11:11 AM UTC
Hi Raymond,
To know type of value field for any property, you can check that using the following link. For example, for cssClass property we need to assign its value as string type. You can confirm this from the following link.
Also, some of the properties might have type as object depend on the C# standards. Though, you can confirm which type of value has to be assigne using the type mentioned for all properties using the following API reference link.
For example, to know the value type for selectedChips (which has blazor type as object), you can confirm it with following link.
Please, let us know if you need further assistance.
Regards,
Shameer Ali Baig S.
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
RA Raymond
- Feb 26, 2020 11:18 PM UTC
- Feb 27, 2020 11:11 AM UTC