Vue-tables-2: Allow pagination to be disabled through options

Created on 4 Jul 2017  路  11Comments  路  Source: matfish2/vue-tables-2

The pagination template starts with this check:

if (that.opts.pagination && !that.opts.pagination.dropdown) {

which led me to believe I could set the options object to include a falsy pagination property to stop rendering the pagination elements, like so

{ pagination: false }

However, on init-options.js the user options are merged with default values:

localOptions = merge.recursive(defaults, localOptions);)

which include an object as default value for pagination. merge will take the default object instead of false, so the check done in the pagination template always resolve the first check to true, preventing one from disabling pagination this way (you can check it here).

I see two options of enabling the user to control whether pagination is enabled through configuration.

  1. On init-options.js manually check for falsy on the global/local options and set final opts accordingly
  2. Add a enabled property to the pagination object and check for that on the template.

Do you think we could get either 1 or 2 into master? I can send a PR if you let me know your preference (or any other suggestion).

Most helpful comment

I have a constrained collection for which the size is fixed and small, so I know I will not paginate it. All is fine for the other pagination elements (they are hidden) but the .VuePagination__count paragraph, which is always rendered (the element that says something like "3 records").

In my particular use case, showing the count is unnecessary and a bit silly from the user point of view. Currently, I use css to hide it.

Since the checks seemed to be already in place in the pagination template render function, it seemed better to me to not render the elements I know I won't need, then to hide it with css later.

All 11 comments

Why would you want to disable pagination?
If you want to display all records in one page (in which case pagination is not shown) simply set a high perPage value.

I have a constrained collection for which the size is fixed and small, so I know I will not paginate it. All is fine for the other pagination elements (they are hidden) but the .VuePagination__count paragraph, which is always rendered (the element that says something like "3 records").

In my particular use case, showing the count is unnecessary and a bit silly from the user point of view. Currently, I use css to hide it.

Since the checks seemed to be already in place in the pagination template render function, it seemed better to me to not render the elements I know I won't need, then to hide it with css later.

How about:

options:{
  texts:{
    count:''
  }
}

I want the option of using a different pagination component than the one that is baked into the template. I would like to disable the included pagination component so that I can use an alternative component in the afterTable slot, for example.

+1 - seems like a good suggestion in the inititial issue/comment. Setting pagination: false should disable pagination

+1 was looking for the same thing when my search landed me here.

+1, currently hiding elements with css, would much rather disable them through options

+1

+1

+1 This would be a good thing.
In my specific case, I want to implement an infinite scroll manually with server-side pagination but using the client table, for this specific case I'd need the table to show all possible values.

+1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

deryckoe picture deryckoe  路  3Comments

pmartelletti picture pmartelletti  路  4Comments

molerat619 picture molerat619  路  4Comments

jigarzon picture jigarzon  路  3Comments

VladZen picture VladZen  路  4Comments