How to Implement ajax pagination with will_paginate gem

前端 未结 6 953
遥遥无期
遥遥无期 2020-12-02 10:19

I am using will_paginate gem in my ROR project to show the records in pages.

I want the next page to be loaded without reloading the whole

6条回答
  •  日久生厌
    2020-12-02 10:35

    Additional to previous answer.

    string of code:

    $(".sort_paginate_ajax th a, .sort_paginate_ajax .pagination a").on("click", function(){
    

    replace with string:

    $(".sort_paginate_ajax").on("click", ".pagination a", function(){
    

    The onclick event applied only to the elements that already exist. So, for new appears links, need delegate click event from parent ".sort_paginate_ajax" to childs ".pagination a".

提交回复
热议问题