FOSCommentBundle icon indicating copy to clipboard operation
FOSCommentBundle copied to clipboard

Pagination

Open merk opened this issue 13 years ago • 18 comments

Some people have requested the ability to paginate the comment thread. Need to test if it is a viable thing to provide or not.

merk avatar Jan 24 '12 10:01 merk

IRC: @asm89 suggests modification to the Tree class to support incomplete trees of comments, which would make paginating a threaded comment tree easier. Some kind of 'load parent comments' link could also work. The queries are already returning results in a way that can be paginated, depending on the sorters.

Sorters will need to be considered as well.

merk avatar Jan 24 '12 10:01 merk

Stage 1 pagination might just involve building the entire comment tree and paginating that array. We could always add more features later, like allowing people who are not using custom sorters to just paginate the query instead.

merk avatar Jan 24 '12 11:01 merk

I would appreciate feedback regarding how people want pagination to work.

merk avatar Feb 19 '12 03:02 merk

I'm interesting for having pagination in this bundle, because I want to use it for comments (in articles) and for a forum. I only need to display the comments in flat mode (no tree), so I think it should be an easy studie case.

cbeyer avatar Feb 23 '12 20:02 cbeyer

Why don't you implement KnpPaginatorBundle ?

remontees avatar May 26 '12 07:05 remontees

Because it will not work for implementing a tree based pagination.

merk avatar May 26 '12 07:05 merk

Tree based pagination ? What's this ? And https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle ?

remontees avatar May 26 '12 07:05 remontees

Wont work either. Pagination of a comment tree is beyond basic pagination.

merk avatar May 26 '12 08:05 merk

I don't understand but I trust. When can we have the pagination ?

remontees avatar May 26 '12 08:05 remontees

is that someone has already started working on a pagination of comments? It would indeed be useful also to allow to display the comments in flat mode (no tree)

simcos avatar Aug 08 '12 06:08 simcos

Noone has been working on pagination at this time. We will accept a PR with the functionality if you wanted to have a go. I will be on #symfony and #symfony-dev later in the day (2 or 3 hours from this post) if you wanted to chat about it.

merk avatar Aug 08 '12 07:08 merk

Why not implement "Load more" like YT pagination, it will be a lot easier.

topwebstudio avatar Dec 19 '12 08:12 topwebstudio

@topweb it does not solve the fact that we are dealing with hierarchical data, and so we need to handle paginating hierarchical data. A Load more link is only a different UI to load the next page, it still requires paginating

stof avatar Dec 19 '12 09:12 stof

There already is a Load more link. You can specify a default maximum depth to display which will hide branches of the tree.

merk avatar Dec 19 '12 21:12 merk

I guess what would be needed to get pagination to work properly, is to move comments to a nested-set implementation so that the paging can be done in the db.

I'm testing an approach now that paginates on roots. I.e select c from Comment where c.ancestors IS NULL limit x, y + then fetch each comments anscestors. This approach isn't perfect and can be much improved but at least it will work :)

tarjei avatar Jan 25 '13 12:01 tarjei

Moving to such an implementation is not possible, it is a major bc break.

I do not agree that pagination should behave that way when using a threaded view, and should behave more like how reddit behaves.

merk avatar Jan 26 '13 00:01 merk

 @merk, I'm not sure I completely understand which parts of my comment you reference. I guess you mean that a nested set implementation would be a BC break (which is true).

Wrt to Reddit, an implementation like that is just a question of how you want to show the comments on the next page - i.e. a JS issue, or is there something I didn't understand?

tarjei avatar Jan 29 '13 09:01 tarjei

In my mind, it isnt possible to paginate a tree of comments. Reddit hides comments after a certain depth (though their algorithm takes into account votes too) and we support that with FOSCommentBundle, with partially loading more comments available as well.

Im not really interested in a pagination implementation that will break bc for existing users, but if you can come up with something simple enough to implement as a choice for users we might be able to put it into a FOSCommentExtra bundle when I move other features not used by most people for v3.0

merk avatar Jan 29 '13 09:01 merk