mirror of
https://github.com/supanadit/todo.git
synced 2024-11-22 01:56:21 +00:00
Enhance search todo
This commit is contained in:
parent
6094e4e2f5
commit
dc0545b113
@ -263,13 +263,24 @@
|
||||
},
|
||||
contentType: "application/json",
|
||||
async: true,
|
||||
beforeSend: function () {
|
||||
$("#todo-list").html("<div style=\"text-align: center;height: 200px;position: relative;\">\n" +
|
||||
" <i class=\"fa fa-spinner fa-spin\" style=\"position: absolute;top:50%;left:50%;\"></i>\n" +
|
||||
" </div>");
|
||||
},
|
||||
success: function (result) {
|
||||
if (result.length !== 0) {
|
||||
$("#todo-list").html(result.map(m => todoComponent(m)));
|
||||
} else {
|
||||
$("#todo-list").html("<div style=\"text-align: center;height: 200px;position: relative;\">\n" +
|
||||
" <p style=\"position: absolute;top:50%;left:50%;color:#777;\"><i class='fa fa-calendar-times-o'></i> Not found or empty</p>\n" +
|
||||
" </div>");
|
||||
if ($("#search-todo").val() != null && $("#search-todo").val() != "") {
|
||||
$("#todo-list").html("<div style=\"text-align: center;height: 200px;position: relative;\">\n" +
|
||||
" <p style=\"position: absolute;top:50%;left:50%;color:#777;\"><i class='fa fa-calendar-times-o'></i> Not found</p>\n" +
|
||||
" </div>");
|
||||
} else {
|
||||
$("#todo-list").html("<div style=\"text-align: center;height: 200px;position: relative;\">\n" +
|
||||
" <p style=\"position: absolute;top:50%;left:50%;color:#777;\"><i class='fa fa-calendar-times-o'></i> Empty</p>\n" +
|
||||
" </div>");
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (result) {
|
||||
|
Loading…
Reference in New Issue
Block a user