Please see the following video
https://www.screencast.com/t/EIs1Cxo7
Attached is the code and razor component page
Version 19.2.0.62 (unable to upgrade as 19.3 breaks my menus) See support ticket 347650
Attachment: Aggregate.razor_7b5466e8.zip
<SfListBox DataSource="@groupA" TItem="ListItem" Height="400px" TValue="string[]" @ref="listbox">
<ListBoxFieldSettings Text="Name" Value="Code"></ListBoxFieldSettings>
<ListBoxToolbarSettings Items="@items"></ListBoxToolbarSettings>
<ListBoxTemplates TItem="ListItem">
<NoRecordsTemplate>
<span>NO DATA AVAILABLE</span>
</NoRecordsTemplate>
</ListBoxTemplates>
<SfButton Content="Cancel" OnClick=@(() => CancelAggregate()) />
@code
{
public void CancelAggregate()
{
groupA = new List<ListItem> ();
}
} |
<SfListBox DataSource="@Data" TValue="string[]" TItem="ListData" AllowDragAndDrop="true">
<ListBoxFieldSettings Text="text" Value="id"></ListBoxFieldSettings>
</SfListBox>
<SfButton CssClass="e-success" @onclick="PropertyBinding">Clear</SfButton>
@code
{
public ObservableCollection<ListData> Data { get; set; }
public class ListData
{
public string id { get; set; }
public string text { get; set; }
public static ObservableCollection<ListData> getListData()
{
ObservableCollection<ListData> Data = new ObservableCollection<ListData>();
Data.Add(new ListData() { text = "Hennessey Venom", id = "list-01" });
Data.Add(new ListData() { text = "Bugatti Chiron", id = "list-02" });
Data.Add(new ListData() { text = "Bugatti Veyron Super Sport", id = "list-03" });
Data.Add(new ListData() { text = "SSC Ultimate Aero", id = "list-04" });
Data.Add(new ListData() { text = "Koenigsegg CCR", id = "list-05" });
Data.Add(new ListData() { text = "McLaren F1", id = "list-06" });
Data.Add(new ListData() { text = "Aston Martin One- 77", id = "list-07" });
Data.Add(new ListData() { text = "Jaguar XJ220", id = "list-08" });
Data.Add(new ListData() { text = "McLaren P1", id = "list-09" });
Data.Add(new ListData() { text = "Ferrari LaFerrari", id = "list-10" });
return Data;
}
}
protected override void OnInitialized()
{
this.Data = ListData.getListData();
}
private void PropertyBinding()
{
this.Data.Clear();
}
}
|
Ah, that works and I understand why.
Thanks.