fix filter bug
This commit is contained in:
parent
568c5b020d
commit
7ec20caf23
@ -91,7 +91,7 @@ TEMPLATE = """
|
||||
{% endblock %}
|
||||
|
||||
{% block script %}
|
||||
var content = document.getElementById('content');
|
||||
var table = document.getElementById('table');
|
||||
var filter = document.getElementById('filter');
|
||||
var filterVal = filter.value.toUpperCase();
|
||||
|
||||
@ -155,10 +155,10 @@ TEMPLATE = """
|
||||
tr.className = colorClass;
|
||||
|
||||
if (filterVal.length > 0 && value.toUpperCase().indexOf(filterVal) == -1) {
|
||||
tr.style.visibility = "collapse";
|
||||
tr.style.display = "none";
|
||||
}
|
||||
|
||||
content.appendChild(tr);
|
||||
table.appendChild(tr);
|
||||
});
|
||||
position = messages.length - 1;
|
||||
}
|
||||
@ -194,25 +194,15 @@ TEMPLATE = """
|
||||
|
||||
function doneTyping() {
|
||||
document.body.style.cursor = 'progress';
|
||||
var table, tr, tds, td, i, txtValue;
|
||||
var tr, tds, td, i, txtValue;
|
||||
filterVal = filter.value.toUpperCase();
|
||||
table = document.getElementById("content");
|
||||
tr = table.getElementsByTagName("tr");
|
||||
for (i = 0; i < tr.length; i++) {
|
||||
tds = tr[i].getElementsByTagName("td");
|
||||
if (tds) {
|
||||
for (l = 0; l < tds.length; l++) {
|
||||
td = tds[l];
|
||||
if (td) {
|
||||
txtValue = td.textContent || td.innerText;
|
||||
if (txtValue.toUpperCase().indexOf(filterVal) > -1) {
|
||||
tr[i].style.visibility = "visible";
|
||||
break;
|
||||
} else {
|
||||
tr[i].style.visibility = "collapse";
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 1; i < tr.length; i++) {
|
||||
txtValue = tr[i].textContent || tr[i].innerText;
|
||||
if (txtValue.toUpperCase().indexOf(filterVal) > -1) {
|
||||
tr[i].style.display = "table-row";
|
||||
} else {
|
||||
tr[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
document.body.style.cursor = 'default';
|
||||
@ -226,7 +216,7 @@ TEMPLATE = """
|
||||
<span><input checked type="checkbox" id="autoscroll"></span>
|
||||
<span><label for="autoscroll"> Autoscroll to bottom</label><br></span>
|
||||
</div>
|
||||
<table id="content">
|
||||
<table id="table">
|
||||
<thead>
|
||||
<th>
|
||||
Time
|
||||
|
Loading…
x
Reference in New Issue
Block a user