bug #4499 Uncaught TypeError: Cannot call method 'substr' of undefined
Signed-off-by: Marc Delisle <marc@infomarc.info>
This commit is contained in:
parent
de9dcd6d95
commit
f079e79590
@ -6,6 +6,7 @@ phpMyAdmin - ChangeLog
|
||||
- bug #4494 Overlap in navigation panel
|
||||
- bug #4427 Action icons not in horizontal order
|
||||
- bug #4493 s_attention.png is missing
|
||||
- bug #4499 Uncaught TypeError: Cannot call method 'substr' of undefined
|
||||
|
||||
4.2.6.0 (2014-07-17)
|
||||
- bug #4471 Undefined index warning with referenced column.
|
||||
|
||||
@ -45,19 +45,36 @@ function appendNewUser(new_user_string, new_user_initial, new_user_initial_strin
|
||||
|
||||
//Calculate the index for the new row
|
||||
var $curr_last_row = $("#usersForm").find('tbody').find('tr:last');
|
||||
var $curr_first_row = $("#usersForm").find('tbody').find('tr:first');
|
||||
var first_row_initial = $curr_first_row.find('label').html().substr(0, 1).toUpperCase();
|
||||
var curr_shown_initial = $curr_last_row.find('label').html().substr(0, 1).toUpperCase();
|
||||
var curr_last_row_index_string = $curr_last_row.find('input:checkbox').attr('id').match(/\d+/)[0];
|
||||
var curr_last_row_index = parseFloat(curr_last_row_index_string);
|
||||
var new_last_row_index = curr_last_row_index + 1;
|
||||
if ($curr_last_row.length) {
|
||||
// at least one tr exists inside the tbody
|
||||
var $curr_first_row = $("#usersForm").find('tbody').find('tr:first');
|
||||
var first_row_initial = $curr_first_row.find('label').html().substr(0, 1).toUpperCase();
|
||||
var curr_shown_initial = $curr_last_row.find('label').html().substr(0, 1).toUpperCase();
|
||||
var curr_last_row_index_string = $curr_last_row.find('input:checkbox').attr('id').match(/\d+/)[0];
|
||||
var curr_last_row_index = parseFloat(curr_last_row_index_string);
|
||||
var new_last_row_index = curr_last_row_index + 1;
|
||||
var is_show_all = (first_row_initial != curr_shown_initial) ? true : false;
|
||||
var $insert_position = $curr_last_row;
|
||||
var dummy_tr_inserted = false;
|
||||
} else {
|
||||
// no tr exists inside the tbody
|
||||
var $tbody = $("#usersForm").find('tbody');
|
||||
// append a dummy tr
|
||||
$tbody.append('<tr></tr>');
|
||||
var dummy_tr_inserted = true;
|
||||
var $insert_position = $tbody.find('tr:first');
|
||||
var is_show_all = true;
|
||||
//todo: the case when the new user's initial does not match
|
||||
// the currently selected initial
|
||||
var curr_shown_initial = '';
|
||||
var new_last_row_index = 0;
|
||||
}
|
||||
var new_last_row_id = 'checkbox_sel_users_' + new_last_row_index;
|
||||
var is_show_all = (first_row_initial != curr_shown_initial) ? true : false;
|
||||
|
||||
//Append to the table and set the id/names correctly
|
||||
if ((curr_shown_initial == new_user_initial) || is_show_all) {
|
||||
$(new_user_string)
|
||||
.insertAfter($curr_last_row)
|
||||
.insertAfter($insert_position)
|
||||
.find('input:checkbox')
|
||||
.attr('id', new_last_row_id)
|
||||
.val(function () {
|
||||
@ -70,6 +87,11 @@ function appendNewUser(new_user_string, new_user_initial, new_user_initial_strin
|
||||
.end();
|
||||
}
|
||||
|
||||
if (dummy_tr_inserted) {
|
||||
// remove the dummy tr
|
||||
$tbody.find('tr:first').remove();
|
||||
}
|
||||
|
||||
//Let us sort the table alphabetically
|
||||
$("#usersForm").find('tbody').PMA_sort_table('label');
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user