Fix bug in Spinner where some query history items didn't work.
This commit is contained in:
parent
5cabe5ecfa
commit
83b0309f23
1 changed files with 8 additions and 6 deletions
|
@ -78,21 +78,23 @@
|
|||
let history = getQueryHistory();
|
||||
|
||||
if (history.length > 0) {
|
||||
let i = 0;
|
||||
for (let item of history) {
|
||||
container.innerHTML += `
|
||||
<tr>
|
||||
<td><button onclick="onHistoryItemClicked('${item}')">^</button></td>
|
||||
<td>${item}</td>
|
||||
<td><button onclick="onHistoryItemClicked(${i})">^</button></td>
|
||||
<td id="history-item-${i}">${item}</td>
|
||||
</tr>
|
||||
`
|
||||
`;
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
container.innerHTML = '<em>None</em>'
|
||||
container.innerHTML = '<em>None</em>';
|
||||
}
|
||||
}
|
||||
|
||||
function onHistoryItemClicked(item) {
|
||||
document.querySelector('.query-input').value = item;
|
||||
function onHistoryItemClicked(i) {
|
||||
document.querySelector('.query-input').value = document.getElementById(`history-item-${i}`).innerText;
|
||||
}
|
||||
|
||||
function getQueryHistory() {
|
||||
|
|
Loading…
Add table
Reference in a new issue