Filter Code

Please refer to this question.

ZekeDroid wrotes:

From here, to hide inconsistent lines, it gets tough. What I did was write a simple function that.

But, clutching the Internet for several hours, I did not find any code.

I present a read-only table, but with many rows. And I have no idea how to write a plugin myself.

to be more specific: You discussed the filter problem in February with Micheael B, and you wrote that you wrote a little code using the search plugin. And it seems to me that Michael used it with some problems.

And, in turn, it seems to me that Michael has access to your code, even in your answer there is no link. I am looking for wwww (the entire world wide web), but have not found anything.

So my main question is: can you show me your code?

My query: I want to filter (shows only) rows matching search criteria. To colorize matched cells, this is just a nice option. Only coloring, as in portable examples, does not make sense if there are 2 hits, and the table has 1000 rows.

0
source share
1 answer

Refer to my question , which is similar to this one, but I also wanted to filter the column separately.

I was able to code the solution you will find in my own Q / A.

So, in your case, if you want a code that hides non-essential lines based on one search criterion , the main function will look like this:

function filter(search) { var row, r_len; var data = myData; var array = []; for (row = 0, r_len = data.length; row < r_len; row++) { for(col = 0, c_len = data[row].length; col < c_len; col++) { if(('' + data[row][col]).toLowerCase().indexOf(search) > -1) { array.push(data[row]); break; } } } hot.loadData(array); } 

Find the complete solution in this JS script

0
source

Source: https://habr.com/ru/post/981947/


All Articles