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

Paging with client side binding

5 Answers 256 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dewang Shah
Top achievements
Rank 1
Dewang Shah asked on 22 Oct 2010, 04:49 PM
I am binding my grid dynamically on the client side with JSON data similar to this example http://demos.telerik.com/aspnet-ajax/grid/examples/client/livedata/defaultcs.aspx. However I cannot get paging to work.

There is no mention on this page http://www.telerik.com/help/aspnet-ajax/client-side-binding-specifics.html of any limitations with paging. I have 25 items in my datasource and the page size is set to 10. However my grid footer shows " Page 1 of 2, items 1 to 10 of 11. " when displaying all 25 items.
<telerik:RadGrid runat="server" ID="RadGrid1" AllowPaging="true" AllowSorting="true" AllowFilteringByColumn="true" PageSize="10">

Do I need to specify anything else to get it to show the correct number of records?

5 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 27 Oct 2010, 08:21 AM
Hi Dewang,

You also need to set the total number of items your service can return using the set_virtualItemCount()  property of the MasterTableView object. If your web service request's OnSuccess handler function is called updateGrid() (like in the example), you need to return the total row count in your service response and update the master table's virtual item count:

function updateGrid(result)
{
    //assume result.data contains the grid data
    //while result.count contains the total row count
    var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
    tableView.set_dataSource(result.data);
    tableView.dataBind();
    tableView.set_virtualItemCount(result.count);
}

This should update the grid pager with the correct number of items and pages.

Veli
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Pramod
Top achievements
Rank 1
answered on 20 Dec 2013, 09:56 AM
Grid is not binding properly after setting the Virtual Item count. Can you tell us the solution as soon as possible
0
Pramod
Top achievements
Rank 1
answered on 20 Dec 2013, 10:08 AM
    After setting the Virtual Count 


                        function OnGetCaseDetailsSuccess(DoctorList, status) {
                            var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
                            tableView.set_dataSource(DoctorList);
                            tableView.dataBind();
                            tableView.set_virtualItemCount(parseInt(DoctorList.length));
                        }

All items are binding in First Page where as Page Size is 10.
0
Eyup
Telerik team
answered on 25 Dec 2013, 02:22 PM
Hello Pramod,

Can you please verify that you are closely following the recommendations provided in this article?
http://www.telerik.com/help/aspnet-ajax/grid-client-side-binding-specifics.html

It would be best if you open a support ticket to send us a very basic runnable web site along with a dummy source demonstrating the problematic behavior. Thus, we will be able to further analyze and debug the application and suggest a proper solution.

Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
John
Top achievements
Rank 1
answered on 18 Dec 2014, 08:39 PM
Seriously???  That much code to go from 10 to 25 rows in your GridView?
Tags
Grid
Asked by
Dewang Shah
Top achievements
Rank 1
Answers by
Veli
Telerik team
Pramod
Top achievements
Rank 1
Eyup
Telerik team
John
Top achievements
Rank 1
Share this question
or