Unplanned
Last Updated: 26 Nov 2024 07:30 by ADMIN
Khaled Salman
Created on: 25 Nov 2024 07:42
Category: UI for ASP.NET Core
Type: Feature Request
1
Dynamic Disabling of Pagination Based on Row Count
*** Support ticket created by Telerik by Progress staff ***
*** Please follow-up with additional details, if necessary. Thank you. ***

There is currently no built-in feature to dynamically disable pagination when the number of grid rows is fewer than the defined page size. I need a way to automatically disable pagination when the number of records is less than or equal to the page size for a smoother user experience. Fig: 1(a)



In the above image, After filtering the data, despite current records are less than the page size but pagination is still appearing.
3 comments
ADMIN
Anton Mironov
Posted on: 26 Nov 2024 07:30

Hello Khaled,

Thank you for the kind words.

Here is the Feature Request public item that I created for the case:

Furthermore, I added a vote on your behalf. The most voted items are considered for implementation.

Best Regards,
Anton Mironov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Khaled Salman
Posted on: 26 Nov 2024 06:27

Hi Anton,

Thank you for sharing the sample project.  Please open a Feature Request for this and we expect that it will be implemented at the earliest possible.

ADMIN
Anton Mironov
Posted on: 25 Nov 2024 13:33

Hello Khaled,

Thank you for the details provided.

My name is Anton and I am a member of the Telerik UI for ASP.NET MVC & Core Team. In order to cover the newly opened cases from my colleague Ivaylo faster, I will join the threads and hopefully achieve the desired behaviors.

Talking about this case - yes, you are totally correct! This behavior is not built-in but is a great idea for a Feature Request. Let me know if you would like me to open a Feature Request on your behalf for this functionality. The most-voted items are considered for implementation.

In order to achieve the desired behavior, I would recommend using the following approach:

  1. Use the "DataBound" Event of the Grid.
  2. In the Event handler, get the instance of the Grid.
  3. Use the "total" and the "pageSize" methods of the dataSource of the Grid.
  4. Compare the results of the methods and hide/show the pager element.
  5. Here is an example:
    // In the Grid:
    .Events(e => e.DataBound("onDataBound"))
    
    // The Event handler:
        function onDataBound(e) {
    
            var grid = e.sender
    
            if (grid.dataSource.total() <= grid.dataSource.pageSize()) {
                grid.pager.element.hide();
            } else {
                grid.pager.element.show();
            }
        }

Attached is a sample project that I prepared for the case. It implements the approach above.

Feel free to test the sample project on your side and let me know if this is the desired result.

Kind Regards,
Anton Mironov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Attached Files: