mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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();
|
||
|
|
||
|
});
|