Finish delete operation.

This commit is contained in:
Paulo Gustavo Veiga 2012-05-23 01:13:00 -03:00
parent fdc4a20667
commit 391c523b43
2 changed files with 7 additions and 21 deletions

View File

@ -49,21 +49,10 @@ jQuery.fn.dataTableExt.getSelectedRows = function() {
}; };
jQuery.fn.dataTableExt.removeSelectedRows = function() { jQuery.fn.dataTableExt.removeSelectedRows = function() {
var mapIds = this.getSelectedMapsIds();
var trs = this.getSelectedRows(); var trs = this.getSelectedRows();
jQuery.ajax({
async:false,
url: "../service/maps/batch?ids=" + mapIds.join(","),
type:"DELETE",
success : function(data, textStatus, jqXHR) {
trs.each(function() { trs.each(function() {
$('#mindmapListTable').dataTable().fnDeleteRow(this); $('#mindmapListTable').dataTable().fnDeleteRow(this);
}); });
},
error: function() {
alert("Unexpected error removing maps. Refresh before continue.");
}
});
}; };
@ -85,6 +74,7 @@ jQuery.fn.dialogForm = function(options) {
formData[elem.name] = elem.value; formData[elem.name] = elem.value;
}); });
var dialogElem = this;
jQuery.ajax(url, { jQuery.ajax(url, {
async:false, async:false,
dataType: 'json', dataType: 'json',
@ -100,9 +90,9 @@ jQuery.fn.dialogForm = function(options) {
window.location = redirectUrl; window.location = redirectUrl;
} else if (options.postUpdate) { } else if (options.postUpdate) {
options.postUpdate(formData); options.postUpdate(formData);
} }
dialogElem.modal('hide');
}, },
error: function(jqXHR, textStatus, errorThrown) { error: function(jqXHR, textStatus, errorThrown) {
if (jqXHR.status == 400) { if (jqXHR.status == 400) {
@ -134,7 +124,7 @@ jQuery.fn.dialogForm = function(options) {
}.bind(this)); }.bind(this));
// Open the modal dialog ... // Open the modal dialog ...
this.modal(options); this.modal();
}; };
@ -146,7 +136,6 @@ function updateStatus() {
$("#mindmapListTable tbody input:checked").parent().parent().addClass('row-selected'); $("#mindmapListTable tbody input:checked").parent().parent().addClass('row-selected');
$("#mindmapListTable tbody input:not(:checked)").parent().parent().removeClass('row-selected'); $("#mindmapListTable tbody input:not(:checked)").parent().parent().removeClass('row-selected');
// Update toolbar ...
$("#buttonsToolbar .act-multiple").hide(); $("#buttonsToolbar .act-multiple").hide();
$("#buttonsToolbar .act-single").hide(); $("#buttonsToolbar .act-single").hide();

View File

@ -77,7 +77,8 @@
bAutoWidth : false, bAutoWidth : false,
oLanguage : { oLanguage : {
"sSearch" : "", "sSearch" : "",
"sInfo" : "_START_-_END_ of _TOTAL_" "sInfo" : "_START_-_END_ of _TOTAL_",
"sEmptyTable": "Hey, you don't have any mindmap. Go head and create one clicking the 'New' button !!!"
}, },
bStateSave:true bStateSave:true
}); });
@ -115,7 +116,6 @@
$("#newBtn").click( $("#newBtn").click(
function() { function() {
$("#new-dialog-modal").dialogForm({ $("#new-dialog-modal").dialogForm({
modal: true,
redirect: "c/map/{header.resourceId}/edit.htm", redirect: "c/map/{header.resourceId}/edit.htm",
url : "../service/maps" url : "../service/maps"
}); });
@ -140,7 +140,6 @@
// Initialize dialog ... // Initialize dialog ...
$("#duplicate-dialog-modal").dialogForm({ $("#duplicate-dialog-modal").dialogForm({
modal: true,
redirect: "c/map/{header.resourceId}/edit.htm", redirect: "c/map/{header.resourceId}/edit.htm",
url : "../service/maps/" + mapId url : "../service/maps/" + mapId
}); });
@ -167,7 +166,6 @@
// Initialize dialog ... // Initialize dialog ...
$("#rename-dialog-modal").dialogForm({ $("#rename-dialog-modal").dialogForm({
modal: true,
type: 'PUT', type: 'PUT',
postUpdate: function(reqBodyData) { postUpdate: function(reqBodyData) {
// Remove old entry ... // Remove old entry ...
@ -190,7 +188,6 @@
if (mapIds.length > 0) { if (mapIds.length > 0) {
// Initialize dialog ... // Initialize dialog ...
$("#delete-dialog-modal").dialogForm({ $("#delete-dialog-modal").dialogForm({
modal: true,
type: 'DELETE', type: 'DELETE',
postUpdate: function(reqBodyData) { postUpdate: function(reqBodyData) {
// Remove old entry ... // Remove old entry ...