Load table with Kaminari pagination using AJAX. The pagination itself is using AJAX as well.
In my controller:
def update_user_list
modal = render_to_string('tables/_user_table', :layout => false, :formats=>[:html]).html_safe
data = {
:table => modal
}
respond_to do |format|
format.json { render :json => data }
end
end
In tables/_user_table
# Table part and content notrelated
<%= paginate @users, :params => {:controller => 'product', :action => 'more_users'}, :remote => true, :theme => 'twitter-bootstrap-3' %>
The response JSON of update_user_list looks like:
{
table=" // the table part
// the pagination part shows as follows
<li class="page"><a href="/product/more_users.json?page=3&user_subgroup_id=1" data-remote="true">3</a></li>
<li class="page"><a href="/product/more_users.json?page=4&user_subgroup_id=1" data-remote="true">4</a>
"
}
What I want is to remove ".json" in the url.
If I just render tables/_user_table without AJAX, not in a JSON object, it doesn't have ".json" in the url.
version: rails: 3.2.17 kaminari: 0.13.0 bootstrap-kaminari-views: 0.0.3
Aucun commentaire:
Enregistrer un commentaire