mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-08 02:31:35 +02:00
This class extends the DataGridPresenter with the behaviour and looks of a paginated Datagrid.
30 lines
696 B
JavaScript
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();
|
|
|
|
}); |