How to set initial page of Kendo Grid

1 posts, 0 answers
  1. Trey
    Trey avatar
    36 posts
    Member since:
    Dec 2006

    Posted 24 Apr 2018 Link to this post

    I know this has been asked multiple times, but i still cannot set the initial page of Kendo Grid

     

    @(Html.Kendo().Grid<TherapistViewModel>()
    .Name("KendoTherapistGrid")
    .AutoBind(false)
    .Columns(columns =>
    {
     ---BOUND COLUMNS---
     
     })
    .Events(e=>e.DataBound("onRowBound"))
    .Pageable(pageable => pageable.Refresh(true).PageSizes(true).ButtonCount(5))
    .Filterable()
    .Sortable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Model(model => model.Id(p => p.TherapistId))
    .Read(read => read.Action("GetTherapistdata", "Therapist").Data("PatientDetails")) ) )

     

    Since AutoBind if false, I am calling ReadDataSource when the document is ready

    $(document).ready(function () {
         ReadDataSource();
    });
     
    function ReadDataSource()
    {
         $("#KendoTherapistGrid").data().kendoGrid.dataSource.page(2);
    }

     

    I am hard-coding the page number for now until I get can it to work.  There are three pages in the grid.

Back to Top