Server filtering: show paging based on total records on

Hi,

I have grid with server filtering that would retrieve and display only 20 records/page from database at a time.

Currently, the paging will have only page number 1 and is disabled. Users are not able to navigate to other pages, as it always considers there is only 1 page.

But I would like be able to show complete paging based on the total records on database (10.000 records), even though the actual record on the DataSource has only 20 records (like fake paging).

So user would still be able to navigate to other page and the custom adaptor would retrieve 20 new other records based on current page number.

Thanks beforehand.


5 Replies

VN Vignesh Natarajan Syncfusion Team September 7, 2021 04:02 AM UTC

Hi Susanti,  
 
Thanks for contacting Syncfusion support.  
 
Query: “show paging based on total records on” 
 
We have analyzed your query and we understand that you are performing custom server side filtering in CustomAdaptor to bind filtered data to Grid. While performing this operation, you are facing a issue with Grid pager.  
 
We would like to inform you that Grid pager will perform based on the total records count in Grid dataSource. While using CustomAdaptor, data has to been returned in form of DataResult class (i.e.) Result and Count format. Here Count has be returned for entire datasource not filtered data count. So that based on Count value Grid pager component will be constructed and paging can be performed properly.  
 
Refer the below code example.  
 
public class CustomAdaptor : DataAdaptor 
{ 
    // Performs data Read operation 
    public override async Task<objectReadAsync(DataManagerRequest dm, string key = null) 
    { 
        IEnumerable<Order> DataSource = Orders; 
. . . . . ..  
        //here in the Count variable, send entire datasource count instead of filtered data count. 
        return dm.RequiresCounts ? new DataResult() { Result = DataSource, Count = count } : (object)DataSource; 
    } 
} 
 
 
So we request you to return entire datasource count instead of filtered data count in Count variable to resolve your issue. Please get back to us if you have further queries or if above solution does not resolve yourquery.     
 
Regards, 
Vignesh Natarajan  
 



SU Susanti September 8, 2021 11:30 PM UTC

Hi Vignesh,


Its all good now. 

I could finally achieve what I want using CustomAdaptor.

Thanks.



RS Renjith Singh Rajendran Syncfusion Team September 9, 2021 05:24 AM UTC

Hi Susanti, 

Thanks for your update. Please get back to us if you need further assistance. 

Regards, 
Renjith R 



VS Vikram Singh Vaid December 12, 2022 04:10 PM UTC

How do we use the Custom adaptor with the SFGrid? Do you have an example.


Thanks

Vikram



SP Sarveswaran Palani Syncfusion Team December 14, 2022 04:17 AM UTC

Hi Vikram,

Query: How do we use the Custom adaptor with the SFGrid?

From your query, we suspect that you want to know about how to use custom adaptor in SfGrid component. We have already discussed about this topic in our UG documentation. Kindly refer the attached
link for UG documentation and sample your reference.

Reference: https://blazor.syncfusion.com/documentation/datagrid/custom-binding

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/DataGrid276967475.zip


Regards,

Sarveswaran PK


Loader.
Up arrow icon