diff options
author | Ashutosh Dhundhara <ashutoshdhundhara@yahoo.com> | 2014-08-13 13:51:01 +0400 |
---|---|---|
committer | Ashutosh Dhundhara <ashutoshdhundhara@yahoo.com> | 2014-08-13 14:29:00 +0400 |
commit | 1ed073f178f65e13635db7bf92ebc5c9e61e7fc0 (patch) | |
tree | b5bc267b5768a570b101993a39ccbabce958b08c /js/tbl_relation.js | |
parent | 48fe645485e44d887dce108120390ad22af37f2f (diff) |
Drop foreign key anchor in Relation view.
Signed-off-by: Ashutosh Dhundhara <ashutoshdhundhara@yahoo.com>
Diffstat (limited to 'js/tbl_relation.js')
-rw-r--r-- | js/tbl_relation.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/js/tbl_relation.js b/js/tbl_relation.js index 67522ed6d0..2da5b20359 100644 --- a/js/tbl_relation.js +++ b/js/tbl_relation.js @@ -115,6 +115,7 @@ AJAX.registerTeardown('tbl_relation.js', function () { ); $('body').off('click', 'a.add_foreign_key_field'); $('body').off('click', 'a.add_foreign_key'); + $('a.drop_foreign_key_anchor.ajax').off('click'); }); AJAX.registerOnload('tbl_relation.js', function () { @@ -190,4 +191,35 @@ AJAX.registerOnload('tbl_relation.js', function () { // Finally add the row. $new_row.insertAfter($prev_row); }); + + /** + * Ajax Event handler for 'Drop Foreign key' + */ + $('a.drop_foreign_key_anchor.ajax').on('click', function (event) { + event.preventDefault(); + var $anchor = $(this); + + // Object containing reference to the current field's row + var $curr_row = $anchor.parents('tr'); + + var question = escapeHtml( + $curr_row.children('td') + .children('.drop_foreign_key_msg') + .val() + ); + + $anchor.PMA_confirm(question, $anchor.attr('href'), function (url) { + var $msg = PMA_ajaxShowMessage(PMA_messages.strDroppingForeignKey, false); + $.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function (data) { + if (data.success === true) { + PMA_ajaxRemoveMessage($msg); + PMA_commonActions.refreshMain(false, function () { + // Do nothing + }); + } else { + PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false); + } + }); // end $.get() + }); // end $.PMA_confirm() + }); //end Drop Foreign key }); |