Skip to content

Commit 19186b2

Browse files
committed
9_02_HW8_clear_filter
1 parent e22bc39 commit 19186b2

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/main/webapp/WEB-INF/jsp/meals.jsp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
</form>
3838
</div>
3939
<div class="card-footer text-right">
40+
<button class="btn btn-danger" onclick="clearFilter()">
41+
<span class="fa fa-remove"></span>
42+
<spring:message code="common.cancel"/>
43+
</button>
4044
<button class="btn btn-primary" onclick="ctx.updateTable()">
4145
<span class="fa fa-filter"></span>
4246
<spring:message code="meal.filter"/>

src/main/webapp/resources/js/topjava.meals.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ const ctx = {
1212
}
1313
};
1414

15+
function clearFilter() {
16+
$("#filter")[0].reset();
17+
$.get(mealAjaxUrl, updateTableByData);
18+
}
19+
1520
$(function () {
1621
makeEditable(
1722
$("#datatable").DataTable({

0 commit comments

Comments
 (0)