Hello,
I am working on a component that uses RadzenDatalist and it is adding two items at the beginning and at the end of the datalist.
This only happens when the allowvirtualization and wrap items properties are set to true
Here is my code:
<RadzenCard class="rz-border-radius-5 h-100">
<h4>Contact List</h4>
<div class="d-flex justify-content-end mb-2">
<RadzenButton Text="Add Contact" Icon="person_add"></RadzenButton>
</div>
<RadzenDataList AllowVirtualization="true"
WrapItems="true" @ref=datalist
Data="@contacts" TItem="Contact">
<Template Context="data">
<RadzenCard class="rz-border-radius-5">
<div class="d-flex justify-content-between">
<div>
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-my-0">Name</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@data.Name</b></RadzenText>
</div>
<div>
<RadzenButton Icon="edit" Size="ButtonSize.Small"></RadzenButton>
<RadzenButton Icon="delete" Size="ButtonSize.Small" ButtonStyle="ButtonStyle.Danger"></RadzenButton>
</div>
</div>
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex mt-2 rz-mb-0">Email</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@data.Email</b></RadzenText>
<RadzenStack Orientation="Orientation.Horizontal" Gap="12">
<div>
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex mt-2 rz-mb-0">Phone</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@data.Phone</b></RadzenText>
</div>
<div>
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex mt-2 rz-mb-0">Ext</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@data.Ext</b></RadzenText>
</div>
</RadzenStack>
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex mt-2 rz-mb-0">Mobile</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@data.Mobile</b></RadzenText>
</RadzenCard>
</Template>
</RadzenDataList>
</RadzenCard>
@code {
[Parameter]
public Client Client { get; set; }
public IList<Contact> contacts { get; set; } = new List<Contact>();
public bool isloading { get; set; } = false;
RadzenDataList<Contact> datalist;
protected override async Task OnParametersSetAsync()
{
isloading = true;
contacts = await ClientService.GetContactsbyClientID(Client.IDT);
isloading = false;
}
}
When one of those is set to false then those cards disappears:
See the code:
<RadzenCard class="rz-border-radius-5 h-100">
<h4>Contact List</h4>
<div class="d-flex justify-content-end mb-2">
<RadzenButton Text="Add Contact" Icon="person_add"></RadzenButton>
</div>
<RadzenDataList AllowVirtualization="false"
WrapItems="true" @ref=datalist
Data="@contacts" TItem="Contact">
<Template Context="data">
<RadzenCard class="rz-border-radius-5">
<div class="d-flex justify-content-between">
<div>
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-my-0">Name</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@data.Name</b></RadzenText>
</div>
<div>
<RadzenButton Icon="edit" Size="ButtonSize.Small"></RadzenButton>
<RadzenButton Icon="delete" Size="ButtonSize.Small" ButtonStyle="ButtonStyle.Danger"></RadzenButton>
</div>
</div>
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex mt-2 rz-mb-0">Email</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@data.Email</b></RadzenText>
<RadzenStack Orientation="Orientation.Horizontal" Gap="12">
<div>
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex mt-2 rz-mb-0">Phone</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@data.Phone</b></RadzenText>
</div>
<div>
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex mt-2 rz-mb-0">Ext</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@data.Ext</b></RadzenText>
</div>
</RadzenStack>
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex mt-2 rz-mb-0">Mobile</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@data.Mobile</b></RadzenText>
</RadzenCard>
</Template>
</RadzenDataList>
</RadzenCard>
@code {
[Parameter]
public Client SClient { get; set; }
public IList<Contact> contacts { get; set; } = new List<Contact>();
public bool isloading { get; set; } = false;
RadzenDataList<Contact> datalist;
protected override async Task OnParametersSetAsync()
{
isloading = true;
contacts = await ClientService.GetContactsbyClientID(SClient.IDT);
isloading = false;
}
}
appreciate your help!!