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

Update Grid PageSize not working in ClientSide Paging Grid

3 Answers 235 Views
Grid
This is a migrated thread and some comments may be shown as answers.
PrimePay
Top achievements
Rank 1
PrimePay asked on 31 Mar 2015, 08:12 PM
I am working on a Client-Side paging grid (ServerOperation(false)) where I need to manually update the page size when a new row has been added using the grid's dataSource.insert() method. The reason for this is because I want to have the new record visible as well as any other existing records on the grid on the same page.

I am updating the page size using the following code when a new record is added:

var grid = $("#myGrid").data("kendoGrid");
var currentPageSize = grid.dataSource.pageSize();
grid.dataSource.pageSize(++currentPageSize);
grid.refresh();

Unfortunately, the above code does not work for Client-Side paging but it works on Server-side paging.

Any assistance would be very welcome.

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 02 Apr 2015, 04:45 PM
Hello,

The code looks correct. Calling refresh is not needed but this should not cause a problem. Could you check this example and let me know if I a missing something?

Regards,
Daniel
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
PrimePay
Top achievements
Rank 1
answered on 07 Apr 2015, 05:01 PM

Thanks Daniel,

 I was doing everything according to the example you provided, the only difference being that I have a button to show and hide rows (on defined conditions), so while I could have 10 rows in the grid, only 6 might be visible. Client-Side paging did not seen to update the dataSource page size.

The only way to fix this was to use server-side paging.

0
Daniel
Telerik team
answered on 09 Apr 2015, 09:07 AM
Hi again,

If some of the rows should not be visible then I you could filter the dataSource. The page size should be correct in this case. I updated the example to demonstrate this case.

Regards,
Daniel
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Grid
Asked by
PrimePay
Top achievements
Rank 1
Answers by
Daniel
Telerik team
PrimePay
Top achievements
Rank 1
Share this question
or