Hi,
Note: seems to be outdated, the EjsListBox its generic and the AddItems method its async now.
Here is the Control's code:
<EjsListBox @ref="ListBoxObj"
TValue="string[]"
DataSource="@models"
ModelType="@typeof(Model)"
AllowDragAndDrop="true">
<ListBoxFieldSettings Text="Text" Value="ID" />
<ListBoxEvents TValue="string[]" />
<ListBoxTemplates>
<ItemTemplate>
[...]
</ItemTemplate>
</ListBoxTemplates>
</EjsListBox>
@code {
EjsListBox<string[]> ListBoxObj;
private async Task OnClick([...])
{
[...]
// attempt #1
await ListBoxObj.AddItems(new Model {});
// attempt #2
await ListBoxObj.AddItems(new List<Model> { new Model {} });
[...]
}
}
Here is the model's class:
public class Model
{
public int ID { get; set; }
public string Text { get; set; }
}
I'm expecting (per the documentation) the new item to be added at the end of the list. But instead, the first time I try, nothing happens if I try a second time the list gets cleared and only the new item appears. Also worth to mention that i tried using both approaches (attempt 1/2 in the code above) with the same results.
Help?
Thanks