gpt4 book ai didi

ruby-on-rails - Rails - 按字母顺序分页/导航

转载 作者:行者123 更新时间:2023-12-04 15:16:52 25 4
gpt4 key购买 nike

是否有可以按字母顺序进行分页/导航的 rails 插件?

我有一个非常大的数据集,除了 1..2...3...4...5 分页之外,我更喜欢为用户提供更直接的导航提示。

我可以自己编写代码,但想知道是否已经有一个像样的插件可以为我完成。

最佳答案

为什么不能将要查看结果的字母表作为参数传递?然后对结果进行分页?那是,

# show results of params[:alphabet] alphabet
@results = fetch_results(params[:alphabet])
# Use Will Paginate to fetch results internally and give a condition that
# fetches results starting with the passed alphabet.

并使用 <%= will_paginate @results %> 显示分页结果(编号)在 View 上。

关于ruby-on-rails - Rails - 按字母顺序分页/导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/554755/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com