silverstripe-framework/javascript/GridFieldPaginator.js
Stig Lindqvist 83e90aaafe ENHANCEMENT Release of DataGridPagination
This class extends the DataGridPresenter with the behaviour and looks of a paginated Datagrid.
2011-10-28 17:34:15 +13:00

30 lines
696 B
JavaScript

jQuery(function($){
var onGridClick = function(){
var form = $(this).closest("form");
var gridField = $(this).closest(".ss-gridfield");
$(this).addClass('loading');
$.ajax({
type: "POST",
url: form.attr('action')+'/field/'+gridField.attr('id'),
data: form.serialize()+"&page="+$(this).attr('value'),
success: function(data) {
$(gridField).replaceWith(data);
gridInit();
},
error: function() {
alert('There seems like there where some failure when trying to fetch the page, please reload and try again.');
}
});
return false;
}
var gridInit = function() {
$('.ss-gridfield-pagination-button').click(onGridClick);
}
gridInit();
});