У меня есть полнотекстовый фильтр для некоторых полей и я хотел бы включить фильтр для проверки, если число <= 0 </p>
Здесь вы видите мой код скрипта, а также мой HTML-код
Я работаю с ASP.NET и некоторыми ViewModels
function filterResult() {
var table, tr, i;
table = document.getElementById("buchliste");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
var td = tr[i].getElementsByTagName("td");
if (
td[0] && td[0].innerHTML.toUpperCase().indexOf(document.getElementById("katInput").value.toUpperCase()) > -1 &&
td[1] && td[1].innerHTML.toUpperCase().indexOf(document.getElementById("titelInput").value.toUpperCase()) > -1 &&
td[2] && td[2].innerHTML.toUpperCase().indexOf(document.getElementById("autorInput").value.toUpperCase()) > -1 &&
td[3] && td[3].innerHTML.toUpperCase().indexOf(document.getElementById("isbnInput").value.toUpperCase()) > -1 &&
td[4] && td[4].innerHTML.toUpperCase().indexOf(document.getElementById("buchBeschreibungInput").value.toUpperCase()) > -1 &&
td[7] && td[7].innerHTML.toUpperCase().indexOf(document.getElementById("verfügbarInput").value.toUpperCase()) > -1
) {
tr[i].style.display = "";
}
else {
tr[i].style.display = "none";
}
}
}
<details>
<summary><label for="Liste filtern">Liste filtern</label></summary>
<br />
<div class="row">
<div class="col-sm-2">
<input class="form-control" type="text" id="katInput" onkeyup="filterResult()" placeholder="Kategorie" />
</div>
<div class="col-sm-2">
<input class="form-control" type="text" id="titelInput" onkeyup="filterResult()" placeholder="Titel" />
</div>
<div class="col-sm-2">
<input class="form-control" type="text" id="autorInput" onkeyup="filterResult()" placeholder="Autor" />
</div>
<div class="col-sm-2">
<input class="form-control" type="text" id="isbnInput" onkeyup="filterResult()" placeholder="ISBN" />
</div>
<div class="col-sm-2">
<input class="form-control" type="text" id="buchBeschreibungInput" onkeyup="filterResult()" placeholder="Buchbeschreibung" />
</div>
<div class="col-sm-2 ">
<label>Verfügbar</label>
<input class="checkbox-inline " type="checkbox" id="verfügbarInput" onkeyup="filterResult()" />
</div>
</div><br />
</details>
В седьмом указателе есть поле с некоторыми целочисленными значениями .... Флажок == verfügbarInput
У меня также есть другой списокс другой стороны - где я должен фильтровать с некоторой ценой от минимальной до максимальной -
Может ли кто-нибудь помочь мне воспользоваться этой проблемой?