Multiselect Problem with DataAdapter and Virtualization
Hi, i'm using a MultiSelect and it's firing the method to load data at initialize, but this is not the normal behavior for the DropDown and Combobox
The problem is that at initial Load it does grab all records, slowing down
I'v set the EnableVirtualization to true and ItemsCount as 10 but it doesn't seems to affect the first data load
this is the configuration i'm using:
<SfMultiSelect TValue="List<UsuarioViewModel>" TItem="UsuarioViewModel" Mode="@VisualMode.CheckBox" AllowCustomValue=false
@bind-Value="@PostoTrabalho.UsuariosPermitidos" AllowFiltering=true ShowSelectAll="true" ShowClearButton="true"
@ref="@MultiUsuarios" EnableVirtualization="true" ItemsCount="10" Placeholder="@Language.Usuarios">
<MultiSelectTemplates TItem="UsuarioViewModel">
<ItemTemplate Context="usuarioContext">
<span class='name'>
<span class="fullname">@((usuarioContext as UsuarioViewModel).NomeCompleto)</span>
<span class="username">@((usuarioContext as UsuarioViewModel).NomeUsuario)</span>
</span>
</ItemTemplate>
</MultiSelectTemplates>
<MultiSelectFieldSettings Text="NomeUsuario" Value="Id" ></MultiSelectFieldSettings>
<MultiSelectEvents TValue="List<UsuarioViewModel>" TItem="UsuarioViewModel" Filtering="OnFilter"></MultiSelectEvents>
<SfDataManager Adaptor="Adaptors.CustomAdaptor">
<DataAdaptorComponent TModel="UsuarioViewModel" Action="Usuario/ListarAtivo">
</DataAdaptorComponent>
</SfDataManager>
</SfMultiSelect>
Note that on the first load of Data the Skip and Take are 0:
The list contains around 600 items, so it's to heavy to the UI
Shouldn't the virtualization enabled make the component call just the data t
SIGN IN To post a reply.
3 Replies
DA
Daniel
October 28, 2021 12:04 PM UTC
Also, is there a feature request for the DropDowns, Combox and Multiselect to have a
ImmediateModeDelay property on filters like Grids have?
DR
Deepak Ramakrishnan
Syncfusion Team
October 29, 2021 04:25 PM UTC
Hi Daniel,
Greetings from syncfusion support.
We are currently recreating the expected scenerio from your end to reproduce the issue you are facing . We will update the possible details in two business days (2nd November 2021) .We appreciate your patience until then.
Thanks,
Deepak R.
DR
Deepak Ramakrishnan
Syncfusion Team
November 11, 2021 06:16 PM UTC
Hi Daniel,
Thanks for your patience.
We have created a sample with custom adapter with virtualization feature as per your requirement kindly refer it for your reference.
|
<div id="ControlRegion">
<SfDropDownList TValue="string" TItem="Order" Query="@Query" EnableVirtualization="true">
<SfDataManager AdaptorInstance="@typeof(CustomAdaptor)" Adaptor="Adaptors.CustomAdaptor"></SfDataManager>
<DropDownListFieldSettings Value="@nameof(Order.OrderID)" Text="@nameof(Order.CustomerID)"></DropDownListFieldSettings>
</SfDropDownList>
</div>
@code{
public Query Query = new Query().Take(20);
protected override void OnInitialized()
{
//Orders = dbContext.Orders.ToList();
}
public class CustomAdaptor : DataAdaptor
{
public OrderContext dbcontext { get; set; }
public CustomAdaptor(OrderContext orderContext)
{
dbcontext = orderContext;
}
// Performs data Read operation
public override object Read(DataManagerRequest dm, string key = null)
{
IEnumerable<Order> DataSource = dbcontext.Orders;
if (dm.Search != null && dm.Search.Count > 0)
{
// Searching
DataSource = DataOperations.PerformSearching(DataSource, dm.Search);
}
if (dm.Sorted != null && dm.Sorted.Count > 0)
{
// Sorting
DataSource = DataOperations.PerformSorting(DataSource, dm.Sorted);
}
if (dm.Where != null && dm.Where.Count > 0)
{
// Filtering
DataSource = DataOperations.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);
}
int count = dbcontext.Orders.Count();
if (dm.Skip != 0)
{
//Paging
DataSource = DataOperations.PerformSkip(DataSource, dm.Skip);
}
if (dm.Take != 0)
{
DataSource = DataOperations.PerformTake(DataSource, dm.Take);
}
return dm.RequiresCounts ? new DataResult() { Result = DataSource, Count = count } : (object)DataSource;
}
}
}
|
Sample Link : https://www.syncfusion.com/downloads/support/forum/168995/ze/SyncfusionBlazorApp1-490649615
If this does not meet your requirement kindly provide the following details to proceed further
1.Simple code sample or modify the provided sample as per your requirement to reproduce the issue
2.If any replication procedure followed to reproduce the issue.
The above details will help us to analyze and provide you the better solution.
Thanks,
Deepak R.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
DA Daniel
- Oct 28, 2021 11:55 AM UTC
- Nov 11, 2021 06:16 PM UTC