Improved response of the Truncate table action on success

This commit is contained in:
ninadsp
2010-08-26 19:53:27 +05:30
parent 7f9d141a85
commit 50f2a0d6ea

View File

@@ -36,6 +36,10 @@ $(document).ready(function() {
* @var question String containing the question to be asked for confirmation
*/
var question = 'TRUNCATE ' + curr_table_name;
/**
* @var this_anchor Object referring to the anchor clicked
*/
var this_anchor = $(this);
$(this).PMA_confirm(question, $(this).attr('href'), function(url) {
@@ -44,8 +48,11 @@ $(document).ready(function() {
$.get(url, {'is_js_confirmed' : 1, 'ajax_request' : true}, function(data) {
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
//need to find a better solution here. The icon should be replaced
$(this).remove();
//Remove the action's href and class, so as to disable further attempts to truncate the table
// @todo: How to replace the icon with the disabled version?
$(this_anchor)
.removeAttr('href')
.removeClass('.truncate_table_anchor');
}
else {
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error);