diff --git a/admin/javascript/AssetTableField.js b/admin/javascript/AssetTableField.js index 1bf5b87ba..f61a24ffa 100644 --- a/admin/javascript/AssetTableField.js +++ b/admin/javascript/AssetTableField.js @@ -124,9 +124,7 @@ AssetTableField.prototype = { }, deleteRecord: function(e) { - var img = Event.element(e); - var link = Event.findElement(e,"a"); - var row = Event.findElement(e,"tr"); + var self = this, img = Event.element(e), link = Event.findElement(e,"a"), row = Event.findElement(e,"tr"); var linkCount = row.getElementsByClassName('linkCount')[0]; if(linkCount) linkCount = linkCount.innerHTML; @@ -139,30 +137,23 @@ AssetTableField.prototype = { if(confirmed) { img.setAttribute("src",'sapphire/admin/images/network-save.gif'); // TODO doesn't work - new Ajax.Request( - link.getAttribute("href"), - { - method: 'post', - postBody: 'forceajax=1' + ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : ''), - onComplete: function(){ - Effect.Fade( - row, - { - afterFinish: function(obj) { - // remove row from DOM - obj.element.parentNode.removeChild(obj.element); - // recalculate summary if needed (assumes that TableListField.js is present) - // TODO Proper inheritance - if(this._summarise) this._summarise(); - // custom callback - if(this.callback_deleteRecord) this.callback_deleteRecord(e); - }.bind(this) - } - ); - }.bind(this), - onFailure: this.ajaxErrorHandler + jQuery.ajax({ + url: link.getAttribute("href"), + method: 'post', + data: {forceajax: 1, SecurityID: jQuery('input[name=SecurityID]').val()}, + success: function() { + jQuery(row).fadeOut('fast', function() { + // remove row from DOM + this.element.parentNode.removeChild(obj.element); + // recalculate summary if needed (assumes that TableListField.js is present) + // TODO Proper inheritance + if(self._summarise) self._summarise(); + // custom callback + if(self.callback_deleteRecord) self.callback_deleteRecord(e); + } } - ); + }); + } Event.stop(e); diff --git a/admin/javascript/MemberTableField.js b/admin/javascript/MemberTableField.js index fa5d57ff0..c275468fb 100755 --- a/admin/javascript/MemberTableField.js +++ b/admin/javascript/MemberTableField.js @@ -307,14 +307,7 @@ MemberFilterButton.prototype = { } updateURL += ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : ''); - new Ajax.Updater( fieldID, updateURL, { - onComplete: function() { - Behaviour.apply($(fieldID), true); - }, - onFailure: function( response ) { - errorMessage('Could not filter results: ' + response.responseText ); - } - }); + jQuery($(fieldID)).get(updateURL, null, function() {Behaviour.apply($(fieldID), true);}); } catch(er) { errorMessage('Error searching'); } @@ -346,12 +339,10 @@ function ajaxSubmitFieldSet(href, fieldSet, extraData) { 'method' : 'post', 'data' : data, 'success' : function(response) { - //alert(response.responseText); - Ajax.Evaluator(response); + eval(response); }, 'error' : function(response) { alert(response.responseText); - //errorMessage('Error: ', response); } }); } \ No newline at end of file diff --git a/javascript/TableListField.js b/javascript/TableListField.js index 6079311ad..343159de3 100755 --- a/javascript/TableListField.js +++ b/javascript/TableListField.js @@ -97,7 +97,7 @@ TableListField.prototype = { jQuery.ajax({ 'url': link.getAttribute("href"), 'method': 'post', - 'data': {forceajax: 1, SecurityID: $('SecurityID') ? $('SecurityID').value : null}, + 'data': {forceajax: 1, SecurityID: jQuery('input[name=SecurityID]').val()}, 'success': function(){ Effect.Fade( row, @@ -183,13 +183,12 @@ TableListField.prototype = { if(el.getAttribute('href')) { jQuery.ajax({ 'url': el.getAttribute('href'), - 'data': {'update': 1, 'params': (params)}, + 'data': {'update': 1}, 'success': function(response) { - Element.replace(self.id, response.responseText); + jQuery('#' + self.id).replaceWith(response) // reapply behaviour and reattach methods to TF container node // e.g.
Behaviour.apply($(self.id), true); - if(oncomplete) oncomplete.apply(response); } }); }