Hi Ernesto,
We have checked your attached query. We suspect that your requirement is to remove/hide an item from ListView component. Yes, it is possible to achieve in ListView component.
In ListView component, we have provided a method RemoveItem() and HideItem() method.
RemoveItem -It is used to remove an item from the ListView and DOM.
HideItem - It is used to remove an item from the ListView.
Note: By default, both this method will work based on the fields loaded in the ListView component. So, to remove or hide an LI item, we need to provide the fields of the data source as arguments to these methods. For this purpose, we need to declare ListViewFieldSettings tag element and need to add the data source fields attributes to the list views mapper fields.
Refer the below code snippet.
|
<EjsListView ID="List" @ref="list"
DataSource="ListData"
HeaderTitle="Contacts"
ShowHeader="true"
CssClass="e-list-template"
Width="350"
SortOrder="Syncfusion.EJ2.Blazor.Lists.SortOrder.Ascending">
<ListViewFieldSettings Id="Id" Text="Name"></ListViewFieldSettings>
<ListViewTemplates>
<Template>
</Template>
</ListViewTemplates>
</EjsListView>
public void RemoveItem()
{
DataModel data1 = new DataModel { Id = "1", };
this.list.RemoveItem(data1);
}
public void HideItem()
{
DataModel data2 =
new DataModel { Id = "2" };
this.list.HideItem(data2);
} |
For your reference, we have prepared a sample.
Please let us know, if you have any concerns.
Regards,
Sowmiya.P