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

Start At Specific Page

3 Answers 156 Views
ListView
This is a migrated thread and some comments may be shown as answers.
stevesuk
Top achievements
Rank 1
stevesuk asked on 19 Sep 2012, 08:20 AM
I have a ListView with a PageSize of 1.as below:-

@(Html.Kendo().ListView<ResultViewModel>()
               .Name("detailListView")
               .TagName("div")
         .DataSource(dataSource =>
         {
             dataSource.Read(read => read.Action("GetDetails", "Result", new { id = ViewBag.TeamId }));
             dataSource.PageSize(1);
          })
            .ClientTemplateId("detail-template")
                .Pageable(pager => pager
                    .Numeric(true)
                    .PreviousNext(true)
                    .Info(true)
                )                
    )

How do I set the initial page number to a number other than 1? The datasource JS has a 'page' option but this wrapper doesn't seem to have one.

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 24 Sep 2012, 06:20 AM
Hello Steve,

Currently the dataSource does not expose a method to configure the initial page. As a work-around you could set the AutoBind option to false and request the desired page with the client API.
e.g.
<script>
$(function(){
    $('#youListView').data().kendoListView.dataSource.page(5);
})
</script>


Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
stevesuk
Top achievements
Rank 1
answered on 24 Sep 2012, 08:20 AM
Thanls for that.

Let's hope the method gets exposed in a future release.

Regards,
Steve.
0
Neil
Top achievements
Rank 1
answered on 17 Jan 2013, 02:59 PM
Hi,

I've had a good look  & this is the post which matches the problem I am having, only the solution doesn't seem to work for me.

I am trying to solve the issue whereby  a user can select say page 5 on the paginated listview, then click on one of the results to see further details. When they return  to the list view the page is always set to page 1 again. 

It looked like the solution above would solve my problem. I turned off AutoBind, I then implemented the function to call the datasource from the client side:

$('#listView').data().kendoListView.dataSource.page($('#SelectedPage').val());

However, the List view still loads with the 1st page selected, seems to ignore the page parameter.

Any insight appreciated.

Tags
ListView
Asked by
stevesuk
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
stevesuk
Top achievements
Rank 1
Neil
Top achievements
Rank 1
Share this question
or