Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prompt before reducing number of rows #13987

Merged
merged 10 commits into from
Feb 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions js/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ function () {
= __('Do you really want to delete the search "%s"?');
$js_messages['strConfirmNavigation']
= __('You have unsaved changes; are you sure you want to leave this page?');
$js_messages['strConfirmRowChange']
= __('You are trying to reduce the number of rows, but have already entered data in those rows which will be lost. Do you wish to continue?');
$js_messages['strDropUserWarning']
= __('Do you really want to revoke the selected user(s) ?');
$js_messages['strDeleteCentralColumnWarning']
Expand Down
21 changes: 15 additions & 6 deletions js/tbl_change.js
Original file line number Diff line number Diff line change
Expand Up @@ -667,12 +667,21 @@ AJAX.registerOnload('tbl_change.js', function () {
$(this).attr('tabindex', tabindex);
});
} else if (curr_rows > target_rows) {
while (curr_rows > target_rows) {
$('input[id^=insert_ignore]:last')
.nextUntil('fieldset')
.addBack()
.remove();
curr_rows--;
/**
* Displays alert if data loss possible on decrease
* of rows.
*/
var checkLock = jQuery.isEmptyObject(AJAX.lockedTargets);
if (checkLock || confirm(PMA_messages.strConfirmRowChange) === true) {
while (curr_rows > target_rows) {
$('input[id^=insert_ignore]:last')
.nextUntil('fieldset')
.addBack()
.remove();
curr_rows--;
}
} else {
document.getElementById('insert_rows').value = curr_rows;
}
}
// Add all the required datepickers back
Expand Down