We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Dynamically changing number of records per page

Thread ID:





130622 May 22,2017 03:35 PM UTC May 25,2017 04:04 AM UTC ASP.NET MVC 4
Tags: Grid
Asked On May 22, 2017 03:35 PM UTC


I am trying to allow the user to dynamically change the number of records per page.

I have followed this thread: https://www.syncfusion.com/forums/116047/allowing-user-to-select-number-of-records-per-page

But receive an error on the code in the debugging console.


    $('#pageSettings').on('change', function (sender) {
        var model = $("#RowSelection").ejGrid("model"); //Will be called when a value is selected in dropdown
        var model1 = $("#RowSelection").ejGrid("getGridPager").ejPager("model");
        var newLastPage = Math.ceil(model.pageSettings.totalRecordsCount / sender.value);

        if (model1.currentPage > newLastPage)
            $("#RowSelection").ejGrid("getGridPager").ejPager("goToPage", newLastPage);

        $("#RowSelection").ejGrid({ "pageSettings": { pageSize: parseInt(sender.value) } }); //Setting the new page size


The error: 

Uncaught ej.Grid: function/property - getGridPager does not exist
Error: ej.Grid: function/property - getGridPager does not exist
    at t.throwError (http://localhost:3082/Scripts/ej/ej.web.all.min.js:10:26895)
    at jQuery.fn.init.n.fn.(anonymous function) [as ejGrid] (http://localhost:3082/Scripts/ej/ej.web.all.min.js:10:21451)
    at HTMLSelectElement.<anonymous> (http://localhost:3082/Anatomy/ViewLinkedItems?includePartials=true&includeP…owSelectiondatetime_CustomDrop2=&RowSelectiondatetime_CustomValue2=:320:45)
    at HTMLSelectElement.dispatch (http://localhost:3082/Scripts/jquery-2.2.4.js:4737:27)
    at HTMLSelectElement.elemData.handle (http://localhost:3082/Scripts/jquery-2.2.4.js:4549:28)

Also I am unsure of the function renderDrop()

The other thread does not show its implementation.


N. Jamieson

Replied On May 23, 2017 08:50 AM UTC

As a side note, I am using the @Html.EJ().Grid() Helper, not the   $("#Grid").ejGrid() javascript way. Not sure if this would make a difference.


Thavasianand Sankaranarayanan [Syncfusion]
Replied On May 23, 2017 04:59 PM UTC

Hi Neill, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and we suspect that you want to change the page size dynamically. In your given code example you have used as “var model1 = $("#RowSelection").ejGrid("getGridPager").ejPager("model")”. getGridPager method name changed as getPager in the latest versions. This is the root cause of the issue. So, change the method name according to the suggestion. 

Refer the below code example. 

function onchange(sender) { 
            var model = $("#Grid").ejGrid("model"); //Will be called when a value is selected in dropdown 
            var model1 = $("#Grid").ejGrid("getPager").ejPager("model"); 
            var newLastPage = Math.ceil(model.pageSettings.totalRecordsCount / sender.value); 
            if (model1.currentPage > newLastPage) 
                $("#Grid").ejGrid("getPager").ejPager("goToPage", newLastPage); 
            $("#Grid").ejGrid({ "pageSettings": { pageSize: parseInt(sender.value) } }); //Setting the new page size 

Refer the help documentation. 

Thavasianand S. 

Replied On May 24, 2017 07:45 AM UTC

Using "getPager" solved my problem.

Thank you.



Thavasianand Sankaranarayanan [Syncfusion]
Replied On May 25, 2017 04:04 AM UTC

Hi Neill, 

We are happy that the problem has been solved. 
Please get back to us if you need any further assistance.  
Thavasianand S. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon