全局排序与 jPaginate 一起打破了下一个/上一个按钮
我似乎无法让 jPaginate (http://web.enavu.com/js/jquery/jpaginate-jquery-pagination-system-plugin/) 与我从 http://net.tutsplus.com/tutorials/javascript-ajax/sorting-values-with-javascript/。我已经敲了好几个小时的头了。问题是,如果我想对项目进行排序,我必须显示所有项目,删除分页 ul,然后重新实例化 jPaginate,以便第 1 页显示前 16 个全局排序 项目,第 2 页显示后 16 个排序的项目等。否则,我会在第 1 页上将项目 1-16 在其内部排序,然后在第 2 页上将项目 17-32 在其内部排序,等等。不幸的是,如果我重新实例化jPaginate,下一个和上一个按钮不再总是有效。
有问题的页面是 http://www.alkemiejewelry.com/collections/bangles ,我'我们在 http://jsfiddle.net/TDBSB/3/ 创建了一个简化的 jsfiddle 副本。尝试单击“价格”按价格排序,然后单击“下一步”。注意一切是如何消失的。
有什么建议吗?
I cannot seem to get jPaginate (http://web.enavu.com/js/jquery/jpaginate-jquery-pagination-system-plugin/) to play nicely with a sorting plugin I got from http://net.tutsplus.com/tutorials/javascript-ajax/sorting-values-with-javascript/. I've been banging my head for hours. The issue is that if I want to sort items I have to show all items, remove my pagination ul, and reinstantiate jPaginate so that page 1 shows the first 16 globally sorted items, page 2 shows the second 16 sorted items, etc. Otherwise I get items 1-16 sorted within themselves on page 1, then items 17-32 sorted within themselves on page 2, etc. Unfortunately, if I reinstantiate jPaginate, the Next and Previous buttons no longer always work.
The page in question is http://www.alkemiejewelry.com/collections/bangles and I've created a simplified jsfiddle copy at http://jsfiddle.net/TDBSB/3/. Try clicking "Price" to sort by Price and then click "Next". Notice how everything disappears.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道 jquery 的分页插件,但在同一组元素上多次使用这个插件看起来有点奇怪。也许您应该检查是否有办法从元素中删除分页插件并在排序后再次添加它。
然而,我确实发现在客户端进行这种排序很奇怪。当你有越来越多的物品(比如几百个)时,插件将如何保持?我会在服务器端使用数据库上的简单排序来完成此类操作。
I don't know the paginate-plugin for jquery, but it looks a bit odd to use this plugin on the same set of elements multiple times. Maybe you should check if there is a way to remove the paginate plugin from the element and add it again after sorting it.
I do ,however, find it quite weird to do this kind of sorting on the client-side. How will the plugin hold up when you have more and more items(say like a couple of hundred)? I would do this kind of stuff server-side using a simple sort on the database.