Skip to content

Commit 5eb1ad8

Browse files
Update search table
1 parent 3edf4e6 commit 5eb1ad8

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

assets/js/script.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -538,13 +538,19 @@ document.addEventListener(SEARCH_DATA, () => {
538538
const title = document.getElementById('search').value
539539
const data = searchBook(title)
540540
searchContent.innerHTML = ''
541-
if (data !== undefined) searchContent.append(data)
542-
else swal({
543-
title: 'Failed',
544-
text: 'Data is not found !',
545-
icon: 'error',
546-
button: 'OK'
547-
})
541+
542+
if (data !== undefined) {
543+
const searchResultTable = document.getElementById('search-content-table')
544+
searchResultTable.style.display = `table`
545+
searchContent.append(data)
546+
} else {
547+
swal({
548+
title: 'Failed',
549+
text: 'Data is not found !',
550+
icon: 'error',
551+
button: 'OK'
552+
})
553+
}
548554
document.getElementById('search').value = ''
549555
})
550556
})

assets/js/style-addon.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@ document.addEventListener('DOMContentLoaded', () => {
1515

1616
const editYear = document.getElementById('edit-year')
1717
editYear.setAttribute('max', `${+new Date().getFullYear()}`)
18+
19+
const searchResultTable = document.getElementById('search-content-table')
20+
searchResultTable.style.display = `none`
1821
})

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ <h1 class="font-weight-medium">Book Data</h1>
5757
</form>
5858
</div>
5959
<div class="table-responsive" style="padding-bottom: 20px;">
60-
<table>
60+
<table id="search-content-table">
6161
<thead>
6262
<tr>
6363
<th>Name</th>

0 commit comments

Comments
 (0)