Possible fix for the chore & battery dropdown clearing issue - #1560 (#1561)

* Possible fix for the chore & battery dropdown clearing issue - #1560

* Revert formatting changes - #1560

Co-authored-by: Akos Pinter <akos.pinter@mhp.com>
This commit is contained in:
Akosh Pinter 2021-08-04 17:06:40 +02:00 committed by GitHub
parent 9f9b9d864e
commit 1fafd32aaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 26 deletions

View File

@ -140,19 +140,20 @@ $('#battery_id_text_input').on('blur', function(e)
{
possibleOptionElement = $("#battery_id option[value=\"" + gc[2] + "\"]").first();
}
}
if (possibleOptionElement.length > 0)
{
$('#battery_id').val(possibleOptionElement.val());
$('#battery_id').data('combobox').refresh();
$('#battery_id').trigger('change');
}
else
{
$('#battery_id').val(null);
$('#battery_id_text_input').val("");
$('#battery_id').data('combobox').refresh();
$('#battery_id').trigger('change');
if (possibleOptionElement.length > 0)
{
$('#battery_id').val(possibleOptionElement.val());
$('#battery_id').data('combobox').refresh();
$('#battery_id').trigger('change');
}
else
{
$('#battery_id').val(null);
$('#battery_id_text_input').val("");
$('#battery_id').data('combobox').refresh();
$('#battery_id').trigger('change');
}
}
});

View File

@ -161,19 +161,19 @@ $('#chore_id_text_input').on('blur', function(e)
{
possibleOptionElement = $("#chore_id option[value=\"" + gc[2] + "\"]").first();
}
}
if (possibleOptionElement.length > 0)
{
$('#chore_id').val(possibleOptionElement.val());
$('#chore_id').data('combobox').refresh();
$('#chore_id').trigger('change');
}
else
{
$('#chore_id').val(null);
$('#chore_id_text_input').val("");
$('#chore_id').data('combobox').refresh();
$('#chore_id').trigger('change');
if (possibleOptionElement.length > 0)
{
$('#chore_id').val(possibleOptionElement.val());
$('#chore_id').data('combobox').refresh();
$('#chore_id').trigger('change');
}
else
{
$('#chore_id').val(null);
$('#chore_id_text_input').val("");
$('#chore_id').data('combobox').refresh();
$('#chore_id').trigger('change');
}
}
});