Has anyone tried to make a SfListView from a Custom Data Adaptor?

Thanks in advance for reading. I have a use case where I'm trying to make a ListView populate from a Data Adaptor. I want to implement paging (skip and take) and I'm having trouble wiring up the DataManager. Any tips out there?


1 Reply

SS Sivakumar ShunmugaSundaram Syncfusion Team September 25, 2025 07:39 AM UTC

Hi Doug,
Yes, it's possible to populate an SfListView using a custom data adaptor with SfDataManager for paging. The key is to nest SfDataManager inside SfListView, use a Query for initial paging, and update the query dynamically in the SfPager's PageChanged event. The custom adaptor handles the data operations.
@using Syncfusion.Blazor.Lists
@using Syncfusion.Blazor.Data
@using Syncfusion.Blazor.Navigations
@using Syncfusion.Blazor

<SfListView TValue="VehicleData" Query="@DataQuery">
    <ListViewFieldSettings TValue="VehicleData" Text="Text" Id="Id" />
    <SfDataManager @ref="DataManagerRef" AdaptorInstance="@typeof(CustomAdaptor)"
                   Adaptor="Adaptors.CustomAdaptor">
    </SfDataManager>
</SfListView>
<SfPager PageSize="3" TotalItemsCount="9" PageChanged="click">
</SfPager>

@code {
   ...

    public Query DataQuery = new Query().Take(3);

    public void click(PageChangedEventArgs args)
    {
        int pageSize = 3;
        DataQuery = new Query().Skip((args.CurrentPage - 1) * pageSize).Take(pageSize);
    }

    public class CustomAdaptor : DataAdaptor
    {
        public override object Read(DataManagerRequest dm, string key = null)
        {
            IEnumerable<VehicleData> DataSource = Vehicles;
            int count = DataSource.Cast<VehicleData>().Count();
            DataSource = DataOperations.Execute<VehicleData>(DataSource, dm);
            return dm.RequiresCounts ? new DataResult() { Result = DataSource, Count = count } : (object)DataSource;
        }
    }
}


Sample: Attached as zip file.
Please check the shared details and get back to us if you need any further assistance.

Regards,

Sivakumar S


Attachment: Components_395ed07e.zip

Loader.
Up arrow icon