GetSelectedChips() - This method returns the selected chips data.
SelectedChips - This property returns the selected chips indices or Value attribute.
Select - Use this method to select a chip item.
Remove - Use this method to remove a chip item. |
async public void onClick()
{
// this method returns the selected chips data
var selectedChipsData = await this.chipObj.GetSelectedChips();
// this property returns the selected chips indices
var selectedItems = this.chipObj.SelectedChips;
// use this method to select a chip item
this.chipObj.Select(new int[] { 2 });
// use this method to remove a chip item
this.chipObj.Remove(this.chipObj.SelectedChips);
} |
selectedChipsData
{{
"texts": [
"Extra Small",
"Large"
],
"Indexes": [
0,
3
],
"data": [
{
"enabled": true,
"text": "Extra Small",
"value": "zero",
"guid": 53724
},
{
"enabled": true,
"text": "Large",
"value": "three",
"guid": 51220
}
],
"elements": [
{},
{}
]
}}
ChildrenTokens: Count = 4
Count: 4
First: {"texts": [
"Extra Small",
"Large"
]}
HasValues: true
Last: {"elements": [
{},
{}
]}
Next: null
Parent: null
Path: ""
Previous: null
Root: {{
"texts": [
"Extra Small",
"Large"
],
"Indexes": [
0,
3
],
"data": [
{
"enabled": true,
"text": "Extra Small",
"value": "zero",
"guid": 53724
},
{
"enabled": true,
"text": "Large",
"value": "three",
"guid": 51220
}
],
"elements": [
{},
{}
]
}} |
async public void onToggleClick()
{
Temp account = JsonConvert.DeserializeObject<Temp>((await chip.GetSelectedChips()).ToString());
// Selected text value
string selectedChipText = account.text;
// Selected index value
int index = account.index;
// Selected chip value inside the data.
string data_value = account.data.value;
}
public class Temp
{
public string text { get; set; }
public string value { get; set; }
public int index { get; set; }
public Temp data { get; set; }
} |
For WASM Chips, getting multi chips seems impossible ?
Json string seems not working correctly ?
Can you give an example where you use the latest Syncfusion release and also multi selected chips ? using the method GetSelectedChips() ?