lorenzofox3 / Smart-Table

Code source of Smart Table module: a table/grid for Angularjs
http://lorenzofox3.github.io/smart-table-website/
1.8k stars 513 forks source link

items by page - negative numbers break pagination #785

Open woodk123 opened 7 years ago

woodk123 commented 7 years ago

Summary When you set items by page to a negative number the pagination breaks.

Steps to reproduce: Set items by page to a negative number. Set to a positive number. The pagination and number of items displayed does not work any more.

Expected result when set back to positive: The table displays the correct number of items.

This is broken on your demo site http://lorenzofox3.github.io/smart-table-website/

And on the project on my machine my machine I'm using: angular-smart-table 2.1.8 angular 1.5.5

lorenzofox3 commented 7 years ago

why would you put a negative number in the first place...that does not make any sense ?

woodk123 commented 7 years ago

Agreed. However if you accidently click down (on the number modifier) it does break the table as there would be a negative number

MrWook commented 7 years ago

Hello @woodk123,

which example is broken on the documentation site? I didn't find it. What i found is that only the last example have a pagination where you can do a step back with a button but it don't go further then 1, so it don't break. Normally you build up your pagination likes this or disable the button complete if you are on page 1.

I consider this not as a bug but more like user error.

woodk123 commented 7 years ago

Hi @MrWook ,

Thanks for your reply.

Apologies, do a string search for items by page until you find the following section (see the uploaded image) capture Set this to a minus number either manually or by pressing the up down keys on your keyboard. You will notice the moment a negative number is present, the general functionality of the items by page will be broken.

MrWook commented 7 years ago

Oh yes that's my fault i misread what you said. I thought you meant the pagination by itself not the items by page.

I think you should lock the field to a minimum of value of 0 if you want to use a similar input field so it will never be able to go under 0