mirror of
https://github.com/UndefinedOffset/SortableGridField.git
synced 2024-10-22 17:05:38 +02:00
Removed reload of table after dropping item
This commit is contained in:
parent
f30a4c8abe
commit
2285cfa7cb
@ -14,35 +14,54 @@
|
|||||||
gridField.find('tbody').sortable({
|
gridField.find('tbody').sortable({
|
||||||
disabled: ($(this).is(':checked')==false),
|
disabled: ($(this).is(':checked')==false),
|
||||||
helper: function(e, ui) {
|
helper: function(e, ui) {
|
||||||
//Maintains width of the columns
|
//Maintains width of the columns
|
||||||
ui.children().each(function() {
|
ui.children().each(function() {
|
||||||
$(this).width($(this).width());
|
$(this).width($(this).width());
|
||||||
});
|
});
|
||||||
|
|
||||||
return ui;
|
return ui;
|
||||||
},
|
},
|
||||||
update: function(event, ui) {
|
update: function(event, ui) {
|
||||||
var dataRows=[];
|
var dataRows=[];
|
||||||
var gridItems=gridField.getItems();
|
var gridItems=gridField.getItems();
|
||||||
var button=refCheckbox.parent().find('.sortablerows-toggle');
|
var button=refCheckbox.parent().find('.sortablerows-toggle');
|
||||||
|
|
||||||
|
|
||||||
for(var i=0;i<gridItems.length;i++) {
|
for(var i=0;i<gridItems.length;i++) {
|
||||||
dataRows[i]=$(gridItems[i]).data('id');
|
dataRows[i]=$(gridItems[i]).data('id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gridField.reload({data: [
|
var form = gridField.closest('form'),
|
||||||
{
|
focusedElName = gridField.find(':input:focus').attr('name'); // Save focused element for restoring after refresh
|
||||||
name: button.attr('name'),
|
var ajaxOpts = {data: [
|
||||||
value: button.val()},
|
{
|
||||||
{
|
name: button.attr('name'),
|
||||||
name: 'Items',
|
value: button.val()},
|
||||||
value: dataRows
|
{
|
||||||
}
|
name: 'Items',
|
||||||
]
|
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();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user