php – How to hide the per page options from laravel nova resource filter dropdown?-ThrowExceptions

Exception or error:

I need to hide the per page filter option from a specific resource. I can change the per page filter option though I can’t find out how to hide that and then add the default pagination of 100 row per page in laravel nova.

On the nova filters dropdown we get an option named per page where the default options are [25,50,100].

Though we can easily change the per page options to any number, but how can we hide the entire per page option from filter and then add the default data of 100 rows per page, which will be unchangeable?

This means I need to load 100 rows per page on a resource and don’t want to show the option of per page in filter section on a resource table in laravel nova. so that user can’t change the per page data option and get a default 100 row of per page.

For more clarification suppose I have a posts resource on the dashboard and I have an option in the filter section to determine how many post rows I want to show on per page. I need the customization here. I want too remove the per page options from filter section so that user can’t change that and then I want a default 100 rows per page value. mean per page user will see 100 post list on the posts table.

How to solve:

If you dive in source code. Sadly there is no option for hiding perPage selector, it is hard-coded. So the only way, overriding FilterMenu component.

  • create custom tool
  • copy contents of /nova/resources/components/FilterMenu.vue to your component
  • override as:
Nova.booting((Vue, router, store) => {
   Vue.component('filter-menu', require('./path/CustomFilterMenu'))

Leave a Reply

Your email address will not be published. Required fields are marked *