This is a migrated thread and some comments may be shown as answers.

Paging only showing first 10 Records

2 Answers 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Julian
Top achievements
Rank 1
Julian asked on 24 Jul 2018, 03:58 PM

Hi ,

 

Hope you can help . I have a grid that is using SP via Enity Framework . If I do not using paging it pulls back all the records . However when I enable Paging it shows the correct number of pages but will only show the first 10 records ( or how many I set in PageSize() ) if I click on page 2, 3, , etc I see the same records .

This is my grid 

 

@model IEnumerable<SchoolsDisruptionPortal.Models.spSchoolsUserID_Result>
@{
    ViewBag.Title = "ListSchoolsUserID";
}
 
<h2>@Resource.SchoolUser</h2>
 
@(Html.Kendo().Grid(Model).Name("SchoolsUserID").Columns(c =>
{
    c.Bound(p => p.FriendlyName).Title(Resource.SchoolName).Width(450);
    c.Bound(p => p.Full_Name).Title(Resource.FullName).Width(300);
    c.Bound(p => p.Username).Title(Resource.UserName).Width(200);
 
 
 
 
})
.Pageable()
.ToolBar(tools => tools.Excel().Text(Resource.Export)).Excel(excel => excel.FileName(@Resource.SchoolUser + ".xlsx").AllPages(true))
.DataSource ( d => d
    .Ajax()
    .PageSize(30)
    )
 
)

 

I know it`s going to be something simple . It`s not a major requierment to my project but would make it look cleaner .

2 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 26 Jul 2018, 08:57 AM
Hello Julian,

I expect that the problem will be fixed if you set ServerOperation(false) in the DataSource configuration, like shown in the local binding demo:
Local Binding

.DataSource(dataSource => dataSource       
    .Ajax()
    .PageSize(20)
    .ServerOperation(false)       
 )


The reason for this is that the Ajax DataSource by default performs server operations but when you are using local binding, the Grid has no configuration for server operation (Read method). When using local (model) binding, the entire data needs to be on the client from the beginning. If the data that you are loading is big, it is better to switch to Ajax binding in the Grid by using a Read method and keeping the server operations, like shown in this demo:
Grid / Binding to remote data

With such configuration, the Grid can page through large amounts of data without delays.

Regards,
Tsvetina
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Julian
Top achievements
Rank 1
answered on 26 Jul 2018, 09:49 AM
Awersome thank you . Knew it would be simple :) 
Tags
Grid
Asked by
Julian
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Julian
Top achievements
Rank 1
Share this question
or