angular-data-table icon indicating copy to clipboard operation
angular-data-table copied to clipboard

paging size not calculated accurately

Open agaurav opened this issue 9 years ago • 3 comments

Currently on moving to next page by clicking next button or the page button, 1 element is always getting skipped. A pen demonstrating the issues (on moving to page 2 the id seems to be starting from 5 instead of 4) http://codepen.io/opavader/pen/vGZdRZ

I tried to fix this on my own fork and it seems the the size calculated @ https://github.com/Swimlane/angular-data-table/blob/master/src/components/DataTableController.js#L130 doesn't need to be padded with 1,

Doing that I was able to get the expected behaviour, as shown here http://codepen.io/opavader/pen/QNgQxz

Will be happy to submit a pull request if doesn't breaks anything.

agaurav avatar Mar 27 '16 14:03 agaurav

Hmm interesting. I know there was a reason we did that. :S

amcdnl avatar Mar 28 '16 12:03 amcdnl

Might have been for ensuring that page size is never less than 1 (which will make number of pages infinite) but the ceiling function does that any way. Ideally even that should be floor so that even the last element completely fits in. IMHO this should do

this.options.paging.size = Math.max(Math.floor(
      this.options.internal.bodyHeight / this.options.rowHeight),1);

agaurav avatar Mar 28 '16 17:03 agaurav

any updates on this?

agaurav avatar May 10 '16 17:05 agaurav