web-components icon indicating copy to clipboard operation
web-components copied to clipboard

[grid] Pagination

Open jouni opened this issue 8 years ago • 20 comments

In some use cases, a paginated data grid is easier for the user than a purely scrolling one. Also, scrolling and paging can be nicely combined with "virtual paging", as you can see in this example.

This could be added as an example (not directly baked in as a feature), and we could provide the pagination element as an official add-on that can be added below the grid without any extra configuration. On top of that, the scrolling could be disabled with some extra property perhaps.

In the meantime, use this pagination example as a starting point: https://cdn.vaadin.com/vaadin-grid/2.0.0-beta1/demo/pagination.html

jouni avatar Aug 29 '16 07:08 jouni

+1 Paging is a very important use case. Please add it. Also is there any workaround/Add on /example in which we can implement paging in current release ?

kgidwani3 avatar Oct 21 '16 12:10 kgidwani3

+1 I like the idea of "virtual paging", looks really great. I believe paging is a must have feature..

pedjapesic avatar Oct 23 '16 10:10 pedjapesic

Here’s an example for grid 1.x: https://cdn.vaadin.com/vaadin-core-elements/master/vaadin-grid/demo/headers.html#toc_6_pagination

Though, it seems like it doesn’t work in Safari, but I think there are some implementation bugs in that demo. You should be able to use the concept still.

jouni avatar Oct 24 '16 09:10 jouni

Food for thought, I had a user asking about paging for IDT (iron-data-table) so I cooked up this example: http://jsbin.com/kihusukoxu/edit?html,output (works in Chrome).

So when we start applying this for grid, it might just be enough to expose something like page property for notifying/controlling the current scroll position, and the creating a custom element which just adds paging controls on top of that.

Saulis avatar Dec 06 '16 21:12 Saulis

For reference, we have an official pagination example now for 2.0: https://cdn.vaadin.com/vaadin-grid/2.0.0-beta1/demo/pagination.html

jouni avatar Mar 23 '17 12:03 jouni

I came across another nice little detail regarding pagination controls:

jouni avatar Nov 27 '17 10:11 jouni

I came across another nice little detail regarding pagination controls:

Here's the recursive hell of popups in case of 25 pages.

 1 2 3 ... 23 24 25

      4
      5
      6
      ...   ->  7 8 9 ... 16 17 18
      19               10
      20               11  
      21               12
                       13
                       14
                       15
                      

limonte avatar Nov 27 '17 10:11 limonte

That would of course not happen. There would only be one dropdown, which scrolls if there are a lot of items.

jouni avatar Nov 27 '17 10:11 jouni

Hmm interesting yes, but I am not sure that this is very useful. I have cases with hundreds of pages. User does not know on which page he will find the result so there is no need to allow clicking on particular page number. It would be just enough for the user to sequentially go on next, previous, first or last page. Why not something simple as this:

paging

pedjapesic avatar Nov 27 '17 10:11 pedjapesic

I have cases with hundreds of pages. User does not know on which page he will find the result so there is no need to allow clicking on particular page number.

That is possibly true for in your use case. But I expect that in some other cases, the user could very well know on which page a certain item is (from previous sessions, if the data set is fairly stable). Or, when browsing search results, they could remember a certain item which was closest to the one they were looking for, and they could then easily return to that page with one click.

We have no concrete plans or designs for this feature yet, but please keep the ideas and use cases coming – thanks!

jouni avatar Nov 27 '17 10:11 jouni

Ok but than again, instead of current page you can make text field to change it's value and that would be it.

pedjapesic avatar Nov 27 '17 10:11 pedjapesic

Do you have a sample code for pagination like this?

On 27 Nov 2017 3:37 p.m., "Jouni Koivuviita" [email protected] wrote:

I came across another nice little detail regarding pagination controls:

https://camo.githubusercontent.com/0fb4885c2e03372b00cd0411f7b84ad9b20c7525/68747470733a2f2f63646e2d696d616765732d312e6d656469756d2e636f6d2f6d61782f313630302f312a4c414d443439746f6378516a3655695657536c6659772e676966

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vaadin/vaadin-grid/issues/452#issuecomment-347135066, or mute the thread https://github.com/notifications/unsubscribe-auth/AS393uoalZX39brQMFrCiJ82RwMXKzIfks5s6onRgaJpZM4JvNa2 .

anikavaish avatar Nov 27 '17 12:11 anikavaish

@anikavaish are you asking me o @jouni ?

pedjapesic avatar Nov 27 '17 14:11 pedjapesic

Maybe something like this: paging

pedjapesic avatar Nov 27 '17 17:11 pedjapesic

Is there anything for grid vaadin 10??

echeypaz avatar Oct 25 '18 12:10 echeypaz

@web-padawan thanks for question referencing.

I didn't succeeded to implement pagination demo to https://github.com/web-padawan/polymer3-webpack-starter/blob/master/src/views/employee-list.js , where items are loaded with ajax from json file. In my case 'WebComponentsReady' listener is never called and paging buttons are not created.
I hope anyone can advise me what should be changed for my use case.

Update: Script tag is moved from template to into imperative code as advised in upgrade documentation. Event handler is now called, but grid element is not found and paging is not working. In this case paging functionality (script tag) is added to body and is not at the same level as grid element

tiho2 avatar Nov 07 '18 18:11 tiho2

Pagination isn't something that completely works, especially when using the dataProvider.

My use case is this.

  • I need pagination, so I'd like to disable infinite scrolling.
  • I need when sorting, filtering data to trigger a request to our backend to provide that data sorted.

The only way I've seen this is possible is via the dataProvider, and that requires me to provide the total number of items, and automatically triggers the infinite scrolling, which in turn triggers the function on the dataProvider which loads more items in the same page

Is there any way I can achieve this via your public api ?

mihaisavezi avatar Mar 18 '19 11:03 mihaisavezi

We are waiting for Java Implementation of Paging Grid impatiently...

ugurdoksan avatar Apr 25 '20 15:04 ugurdoksan

Any progress regarding pagination in vaadin-grid?

vgjokaj avatar Aug 15 '21 20:08 vgjokaj

Will pagination be feasible still on Vaadin at some point in time? very basic functionality.

https://www.ag-grid.com/vue-data-grid/row-pagination/ https://mdbootstrap.com/docs/b4/jquery/tables/datatables1/

@jouni

timoteosoutello avatar Sep 14 '22 02:09 timoteosoutello

Please take a look for extra details in this ticket.

yuriy-fix avatar Nov 08 '22 11:11 yuriy-fix

I would like to ask everybody interested in Grid pagination to take 5 minutes to fill in this survey to help us figure out the details of the feature: https://docs.google.com/forms/d/e/1FAIpQLSd2nXIKaCJFzNS3DLN1fIPaylcLpTbEjwJUKz9_zF9jT76d5g/viewform?usp=sf_link

Ping @alexanoid, @lkraav, @evanpenner and @chrlembeck who've been active in other issues about this.

Big thanks in advance!

rolfsmeds avatar Jul 27 '23 05:07 rolfsmeds

@rolfsmeds thank you! done

alexanoid avatar Jul 30 '23 22:07 alexanoid