Important pagination correction
This commit is contained in:
parent
cd8e7eea9a
commit
449e0e191d
|
@ -1,20 +1,25 @@
|
||||||
# Automatic ajax pagination
|
# Automatic ajax pagination
|
||||||
|
|
||||||
|
# To not setup pagination twice
|
||||||
|
pager = true
|
||||||
$(document).ready ->
|
$(document).ready ->
|
||||||
$('.pagination .next a')
|
$('.pagination .next a')
|
||||||
.attr('data-remote', true)
|
.attr('data-remote', true)
|
||||||
.click ->
|
.click ->
|
||||||
$('#loading').fadeIn()
|
$('#loading').fadeIn()
|
||||||
|
|
||||||
$(document).on 'ajax:success', '.pagination .next a', (event, data, status, xhr) ->
|
if pager
|
||||||
$('#loading').fadeOut()
|
pager = false
|
||||||
elts = $('tbody tr', data)
|
$(document).on 'ajax:success', '.pagination .next a', (event, data, status, xhr) ->
|
||||||
$(this).parents('tfoot').prev().append(elts)
|
$('#loading').fadeOut()
|
||||||
|
elts = $('tbody tr', data)
|
||||||
|
$(this).parents('tfoot').prev().append(elts)
|
||||||
|
|
||||||
next = $('.pagination .next a', data).attr('href')
|
next = $('.pagination .next a', data).attr('href')
|
||||||
if next?
|
if next?
|
||||||
return $(this).show().data('remote', true).attr('href', next)
|
return $(this).show().data('remote', true).attr('href', next)
|
||||||
else
|
else
|
||||||
return $(this).parents('.pagination').remove()
|
return $(this).parents('.pagination').remove()
|
||||||
|
|
||||||
# Go to the next page when page is scrolled
|
# Go to the next page when page is scrolled
|
||||||
if $('.pagination .next a').size() > 0
|
if $('.pagination .next a').size() > 0
|
||||||
|
|
Loading…
Reference in New Issue