I want to use the ListView component to drag and drop items into a div that will ask the user to drop items into as shown in attached file. Once dropped I a method that will store the dragged item in a json list in local stoage.
I have tried to find examples doing something similar but can't see any in the Syncfusion documentation.
Sorry, I should have tagged this as Listbox and not ListView. The example you sent is what i've aready looked at.
Is there a way to style a list when there are no items in it?
|
<div id="listbox1">
<h4>Group A</h4>
<SfListBox TValue="string[]" DataSource="@GroupA" AllowDragAndDrop="true" Scope="combined-list" Height="290px" TItem="CountryCode">
<ListBoxFieldSettings Text="Name" Value="Code" />
</SfListBox>
</div>
<div id="listbox2">
<h4>Group B</h4>
<SfListBox TValue="string[]" DataSource="@GroupB" Scope="combined-list" AllowDragAndDrop="true" Height="290px" TItem="CountryCode" @ref="list2Obj">
<ListBoxFieldSettings Text="Name" Value="Code" />
</SfListBox>
</div>
<SfButton OnClick="getData">Get Updated Data</SfButton>
@code {
SfListBox<string[], CountryCode> list2Obj;
public List<CountryCode> GroupA = new List<CountryCode>
{
new CountryCode{ Name = "Australia", Code = "AU" },
new CountryCode{ Name = "Bermuda", Code = "BM" },
new CountryCode{ Name = "Canada", Code = "CA" },
new CountryCode{ Name = "Cameroon", Code = "CM" },
new CountryCode{ Name = "Denmark", Code = "DK" },
new CountryCode{ Name = "France", Code = "FR" },
new CountryCode{ Name = "Finland", Code = "FI" },
new CountryCode{ Name = "Germany", Code = "DE" },
new CountryCode{ Name = "Hong Kong", Code = "HK" }
};
public List<CountryCode> GroupB = new List<CountryCode>
{
};
public class CountryCode
{
public string Name { get; set; }
public string Code { get; set; }
}
public void getData()
{
var data=this.list2Obj.GetDataList();
}
}
|
|
#listbox2 .e-listbox-container {
background-color: aliceblue;
} |