jQuery.Gantt icon indicating copy to clipboard operation
jQuery.Gantt copied to clipboard

Add option to remove pagination and display all rows.

Open AWilco opened this issue 11 years ago • 5 comments
trafficstars

Added a settings option to paginate the view (on by default). Setting this to off will draw all rows of the gantt chart, and will remove the paginate navigation options.

You could re-create similar behaviour by setting the itemsPerPage to a high number (however the navigation would remain) however this is a precursor to the ability to pan up and down the list as well as left and right.

@usmonster you seem to be the most active regarding pull requests?

AWilco avatar Nov 29 '13 17:11 AWilco

@AWilco, thanks for the pull request!

You're right that the only current way to do that is by setting itemsPerPage to some number (>= source.length if you're passing in an array), and then hiding the paging-related navigation controls, e.g. with a CSS rule:

.fn-gantt .navigate .nav-page-back,
.fn-gantt .navigate .nav-page-next,
.fn-gantt .navigate .page-number{
  display: none;
}

But yeah, this feels a little icky/hacky for something that is possibly a fairly common use case. I never actually use the paging feature anyway, so a nice, clean way to remove that concept from the plugin is definitely appreciated. (There is also a pretty big need for cleanup around the navigation rendering code, which is also on the roadmap.. see #85).

At first glance your approach seems straightforward and relatively minimal, though at this point I'm not sure I'd be comfortable making changes to the navigation construction code until The Great Refactoring. I'm also not sure if we'd want a second explicit paging-related option (e.g., paging), or if we'd instead want to have itemsPerPage fill that role. E.g., we could (and probably should) change the default behavior to show all rows if itemsPerPage is not specified or otherwise undefined|null|0|negative|falsey, instead of assigning the current rather arbitrary initial value of 7. Thoughts, @taitems?

I should be able to return to this within the next couple of weeks, so I'll leave it open for discussion. Hopefully by then I will have landed #85 and we can decide what/how to merge. Thanks again for contributing!

usmonster avatar Dec 02 '13 17:12 usmonster

You're right, integrating with the current itemsPerPage (<=0 to disable) would be a neater solution. I chose a new variable mainly to make sure I didn't influence any current configurations.

AWilco avatar Dec 03 '13 19:12 AWilco

I like this option and would also like to see an option that allows for paging, but via ajax. ie so you can set the total numbers of items (so that 1/7 workjs) and fetch the new pages from a server

iamnader avatar Jul 23 '14 20:07 iamnader

Is "The Great Refactoring" happening at all? Any chance of this getting merged in?

reustle avatar May 10 '15 10:05 reustle

@reustle Oh, The Great Refactoring is coming. It's part of the milestone after the current one (which has been stalled a bit on week calculation sync-up with moment.js, but should be resolved soon). Sorry for the stall between versions!

usmonster avatar May 10 '15 17:05 usmonster