Skip to content

Commit

Permalink
fix #964 [HxAutosuggest] ReferenceError: dropdown is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
hakenr committed Dec 11, 2024
1 parent 6412d97 commit 08697e0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,10 @@ export function destroy(inputElement) {

const d = bootstrap.Dropdown.getInstance(inputElement);
if (d) {
d.hide();

inputElement.addEventListener('hidden.bs.dropdown', event => {
dropdown.dispose()
d.dispose()
})
d.hide();
}
}

Expand Down
14 changes: 14 additions & 0 deletions Havit.Blazor.Documentation/DemoData/DemoDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,18 @@ public async Task UpdateEmployeeAsync(EmployeeDto employee, CancellationToken ca
existingEmployee.Position = employee.Position;
existingEmployee.Location = employee.Location;
}

public async Task<int> CreateNewEmployeeAsync(EmployeeDto employee, CancellationToken cancellationToken = default)
{
_logger.LogInformation($"DemoDataService.CreateNewEmployeeAsync() called.");
Contract.Requires<ArgumentException>(employee.Id == 0, "Employee ID must be 0.");

// simulate server call
await Task.Delay(140, cancellationToken);

var newEmployee = employee with { Id = _employees.Max(e => e.Id) + 1 };
_employees.Add(newEmployee);

return newEmployee.Id;
}
}
1 change: 1 addition & 0 deletions Havit.Blazor.Documentation/DemoData/IDemoDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ public interface IDemoDataService

Task UpdateEmployeeAsync(EmployeeDto employee, CancellationToken cancellationToken = default);
Task DeleteEmployeeAsync(int employeeId, CancellationToken cancellationToken = default);
Task<int> CreateNewEmployeeAsync(EmployeeDto employee, CancellationToken cancellationToken = default);
}

0 comments on commit 08697e0

Please sign in to comment.