Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't send param name for page 1 #1061

Open
him-wtag opened this issue Jun 7, 2021 · 1 comment
Open

Doesn't send param name for page 1 #1061

him-wtag opened this issue Jun 7, 2021 · 1 comment

Comments

@him-wtag
Copy link

him-wtag commented Jun 7, 2021

I have pagination on two tabs in the same page with the following way

- param_name = archived_tab ? 'archived_videos_page' : 'videos_page'
= paginate experience_videos, remote: true, param_name: param_name

Based on the param name, the application determines which tab it is currently on. However, problem arise when I click on the pagination button 1(page 1) in the second tab. The request doesn't send the param_name's value with the request params.

Expected

#<ActionController::Parameters {"archived_videos_page"=>"1", "controller"=>"video_administration/videos", "action"=>"index"} permitted: false>

What I got

#<ActionController::Parameters {"controller"=>"video_administration/videos", "action"=>"index"} permitted: false>

Now I have to send an extra param to determine from which tab the request was sent. Is it possible to include page param for all pagination buttons?

Environment

Rails: 6.1.3.2
Ruby: 2.7.2

@ytojima
Copy link

ytojima commented May 15, 2024

<div class="d-flex justify-content-center <%= param_name %>">
    <%= paginate posts, remote: true, param_name: param_name %>    
</div>
<script>  
    $('.<%= paginate_name %> > nav > ul > li.page-item > a').each(function () {
        if ($(this).attr('href') != undefined && $(this).attr('href').match(/\?/) === null) {
            $(this).attr('href', '?<%= param_name %>=1')
        }
    })
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants