Answer the question
In order to leave comments, you need to log in
How to do a search on each column?
Hey!
There is a table with a search for each column and a general search.
Why is the search script not working?
It seems that everything is logically designed
. Each input is stored in the state so that the next input is searched for by previous results.
For some reason this script is not working.
dataHave.map(item => { // перебор массива объектов, где ищем слова
for (let key in searchHave) { // перебор каждого input для поиска
JSON.stringify(item) // объект из массива для поиска превращаем в строку
.toUpperCase()
.indexOf(searchHave[key].toUpperCase()) > -1 // поиск каждого input
? filteredData.push(item) // если вхождения найдены - сохраняем элемент в новый массив
: false;
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question