Chris
Chris

Reputation: 215

How to change the default page size that display element in a grid to display more than 10 elements

So i have a grid with kendo and i have to display 1580 elements. But by default it only display 10 and the user have to choose how many he wants. How to set the default value on 1580 ? I've looked for it with no sucess.

I put the code here :

@(Html.Kendo().Grid<DisplayGridResultatsPrestations>
    ()
     .Name("GridListeIdcc")
     .Columns(columns =>
     {
         columns.Bound(c => c.CategoriePrestation);
         columns.Bound(c => c.DesignationPrestation);
         columns.Bound(c => c.ValeurPreconisee);
         columns.Bound(c => c.ValeurProposee);
         columns.Bound(c => c.DesignationResultat);
      })
      .Filterable()
      .Selectable(selectable => selectable.Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
      .Pageable(builder => builder.PageSizes(new[] { 1580, 1580 }))
      .DataSource(datasource => datasource
      .Ajax()

Upvotes: 0

Views: 1070

Answers (1)

ShawnOrr
ShawnOrr

Reputation: 1329

Try adding .PageSize(1580) within the .DataSource() like below. You may also have to remove what you have inside .Pageable() as well.

@(Html.Kendo().Grid<displaygridresultatsprestations>()
    .Name("GridListeIdcc")
    .Columns(columns =>
    {
        columns.Bound(c => c.CategoriePrestation);
        columns.Bound(c => c.DesignationPrestation);
        columns.Bound(c => c.ValeurPreconisee);
        columns.Bound(c => c.ValeurProposee);
        columns.Bound(c => c.DesignationResultat);
    })
    .Filterable()
    .Selectable(selectable => selectable.Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
    .Pageable()
    .DataSource(datasource => datasource
        .Ajax()
        .PageSize(1580)
    )
)

Upvotes: 1

Related Questions