Fix variables scope
Signed-off-by: Marc Delisle <marc@infomarc.info>
This commit is contained in:
parent
ae491e12c4
commit
cf7775ceca
@ -47,29 +47,35 @@ function appendNewUser(new_user_string, new_user_initial, new_user_initial_strin
|
||||
//Append the newly retrieved user to the table now
|
||||
//Calculate the index for the new row
|
||||
var $curr_last_row = $("#usersForm").find('tbody').find('tr:last');
|
||||
var curr_shown_initial;
|
||||
var is_show_all;
|
||||
var $insert_position;
|
||||
var dummy_tr_inserted;
|
||||
var $tbody;
|
||||
|
||||
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();
|
||||
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;
|
||||
is_show_all = (first_row_initial != curr_shown_initial) ? true : false;
|
||||
$insert_position = $curr_last_row;
|
||||
dummy_tr_inserted = false;
|
||||
} else {
|
||||
// no tr exists inside the tbody
|
||||
var $tbody = $("#usersForm").find('tbody');
|
||||
$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;
|
||||
dummy_tr_inserted = true;
|
||||
$insert_position = $tbody.find('tr:first');
|
||||
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;
|
||||
curr_shown_initial = '';
|
||||
new_last_row_index = 0;
|
||||
}
|
||||
var new_last_row_id = 'checkbox_sel_users_' + new_last_row_index;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user