diff options
author | Marcello Coutinho <marcellocoutinho@gmail.com> | 2014-04-04 10:04:57 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-04-07 11:49:49 -0300 |
commit | 2c0dd2639d5a7fb5c3f4d86db620a7720afb7439 (patch) | |
tree | bff6b6ba7bb233efb4babf50b8c3765825fad20c /usr | |
parent | 539d94b31be6edce765ec3553974bf46aa796025 (diff) | |
download | pfsense-2c0dd2639d5a7fb5c3f4d86db620a7720afb7439.zip pfsense-2c0dd2639d5a7fb5c3f4d86db620a7720afb7439.tar.gz |
fixes Bug #3569
On packages that uses row_helper when user clicks on add or delete button, the page scrolls to top.
It seems something with ajax
http://stackoverflow.com/questions/1061580/jquery-click-on-anchor-element-forces-scroll-to-top
A simple return false after jquery action fixes the unwanted scroll.
Diffstat (limited to 'usr')
-rw-r--r-- | usr/local/www/pkg_edit.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr/local/www/pkg_edit.php b/usr/local/www/pkg_edit.php index c02956f..150f718 100644 --- a/usr/local/www/pkg_edit.php +++ b/usr/local/www/pkg_edit.php @@ -295,8 +295,10 @@ if ($pkg['custom_php_after_head_command']) //delete current line jQuery function jQuery('#maintable td .delete').live('click', function() { //do not remove first line - if (jQuery("#maintable tr").length > 2) + if (jQuery("#maintable tr").length > 2){ jQuery(this).parent().parent().remove(); + return false; + } }); //add new line jQuery function @@ -306,6 +308,7 @@ if ($pkg['custom_php_after_head_command']) var new_row=jQuery("table#maintable tr:last").html().replace(/(name|id)="(\w+)(\d+)"/g,"$1='$2"+c_id+"'"); //apply new id to created line rowhelperid jQuery("table#maintable tr:last").after("<tr>"+new_row+"<\/tr>"); + return false; }); // Call enablechange function enablechange(); |