Datagrid Requests all data when paging is enabled

Hello!
Here is simplest page for example:

@page "/"
@using Minstandart.Models
@using Minstandart.Data
@inject DataContext context   

SfGrid DataSource="@data" AllowPaging="true" EnablePersistence="false" EnableAltRow="true"
   GridPageSettings PageCount="5"
   GridColumns
        GridColumn Field=@nameof(Crm.Id) HeaderText="Id"
    GridColumns
SfGrid

@code{

    public IEnumerable data { get; set; }

    protected override void OnInitialized()
    {
        data = context.Crms;
    }
}

But in the debug output console i see that each paging request retunrs ALL data too.
Am I doing something wrong?
All is needed for paging - is count(*) but not all records.

info: Microsoft.EntityFrameworkCore.Database.Command[20101]
      Executed DbCommand (1ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
      SELECT `c`.`Id`, `c`.`MatrixTypeId`, `c`.`Name`
      FROM `crm` AS `c`
info: Microsoft.EntityFrameworkCore.Database.Command[20101]
      Executed DbCommand (0ms) [Parameters=[@__p_0='12'], CommandType='Text', CommandTimeout='30']
      SELECT `c`.`Id`, `c`.`MatrixTypeId`, `c`.`Name`
      FROM `crm` AS `c`
      ORDER BY (SELECT 1)
      LIMIT @__p_0 OFFSET @__p_0
info: Microsoft.EntityFrameworkCore.Database.Command[20101]
      Executed DbCommand (0ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
      SELECT `c`.`Id`, `c`.`MatrixTypeId`, `c`.`Name`
      FROM `crm` AS `c`
info: Microsoft.EntityFrameworkCore.Database.Command[20101]
      Executed DbCommand (0ms) [Parameters=[@__p_1='12', @__p_0='24'], CommandType='Text', CommandTimeout='30']
      SELECT `c`.`Id`, `c`.`MatrixTypeId`, `c`.`Name`
      FROM `crm` AS `c`
      ORDER BY (SELECT 1)
      LIMIT @__p_1 OFFSET @__p_0


1 Reply

VN Vignesh Natarajan Syncfusion Team April 9, 2020 12:44 PM UTC

Hi Ivan,  

Thanks for contacting Syncfusion support.  

Query: “All is needed for paging - is count(*) but not all records 

From your query we understand that you want to bind data to Grid in a ondemand concept. We have provided support for various types of Adaptor which support ondemand concept. Since you are using sql data source, we suggest you to achieve your requirement using Custom Adaptor as component feature. Custom Adaptor is used to bind the custom data source to Grid. 

Read / ReadAsync method of CustomAdaptor will be triggered for each action in Grid. From DataManagerRequest class you can get the paging details in form of skip and take. Refer the below screenshot. Based on details you can perform paging on your data source.  

 
 
      
Kindly refer our UG documentation and online sample for your reference 


 

Please get back to us if you have any other queries.  

Regards, 
Vignesh Natarajan. 


Loader.
Up arrow icon