Open merk opened 12 years ago
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.
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.
I would appreciate feedback regarding how people want pagination to work.
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.
Why don't you implement KnpPaginatorBundle ?
Because it will not work for implementing a tree based pagination.
Tree based pagination ? What's this ? And https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle ?
Wont work either. Pagination of a comment tree is beyond basic pagination.
I don't understand but I trust. When can we have the pagination ?
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)
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.
Why not implement "Load more" like YT pagination, it will be a lot easier.
@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
There already is a Load more link. You can specify a default maximum depth to display which will hide branches of the tree.
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 :)
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, 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?
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
Some people have requested the ability to paginate the comment thread. Need to test if it is a viable thing to provide or not.