Removed reload of table after dropping item

This commit is contained in:
UndefinedOffset 2012-05-15 12:46:03 -03:00
parent f30a4c8abe
commit 2285cfa7cb

View File

@ -32,7 +32,9 @@
} }
gridField.reload({data: [ var form = gridField.closest('form'),
focusedElName = gridField.find(':input:focus').attr('name'); // Save focused element for restoring after refresh
var ajaxOpts = {data: [
{ {
name: button.attr('name'), name: button.attr('name'),
value: button.val()}, value: button.val()},
@ -40,8 +42,25 @@
name: 'Items', name: 'Items',
value: dataRows value: dataRows
} }
] ]};
});
ajaxOpts.data = ajaxOpts.data.concat(form.find(':input').serializeArray());
// Include any GET parameters from the current URL, as the view state might depend on it.
// For example, a list prefiltered through external search criteria might be passed to GridField.
if(window.location.search) {
ajaxOpts.data = window.location.search.replace(/^\?/, '') + '&' + $.param(ajaxOpts.data);
}
$.ajax($.extend({}, {
headers: {"X-Pjax" : 'CurrentField'},
type: "POST",
url: gridField.data('url'),
dataType: 'html',
error: function(e) {
alert(ss.i18n._t('GRIDFIELD.ERRORINTRANSACTION'));
}
}, ajaxOpts));
} }
}).disableSelection(); }).disableSelection();
}, },