Get Reference of rows which are outside of the page view.

Hello!
I ran into a problem, when I tried to create something like a blacklist, since the filtering options can only filter by one string. (Correct me, if I am wrong)
Therefore I have a checkbox to determine the blacklist and everything works fine. 
The problem is, that I do not know how to hide all the rows that's type are on the blacklist. I iterate through the grid's dataSource and I am able to detect all the rows that need to be filtered / collapsed or whatever (like in the code example below). 

But now, I do not know, how to filter those rows, which are not on the current view / page of the grid because all the methods to get rows of the grid seem to only refer to the current page. Is there a solution for this problem? Is it possible to toggle for example row 24's visibility, although I am currently on page 1 with only 10 rows? 

Thanks in advance!

    for(let i=0i<this.dataSource.lengthi++){
      if(blacklist.includes(this.gridObj.dataSource[i].type)){
        console.log('Row ' + i + ' needs to be filtered');
        console.log(this.gridObj.getRowByIndex(i));
      }
    }

3 Replies 1 reply marked as answer

PG Praveenkumar Gajendiran Syncfusion Team July 8, 2020 09:25 AM UTC

Hi Jonas Czeslik ,

Greetings from Syncfusion support,


Query 1: “since the filtering options can only filter by one string. (Correct me, if I am wrong)”,

You can filter multiple values for a column dynamically using the “filterByColumn()” method as demonstrated in the below code snippet,  

grid.filterByColumn("CustomerName", "contains", ["Paul", "Karin", "Mario"]);  


Using this method you can filter the required values in the Grid column.

Query 2: “ I do not know, how to filter those rows, which are not on the current view / page of the grid because all the methods to get rows of the grid seem to only refer to the current page. Is there a solution for this problem? 
 
You can get only current view records by using “getCurrentViewRecords()” method of Grid. But the Grid filtering allows you to filter the entire dataSource of Grid by using filterByColumn()” method of Grid.

If we misunderstood your requirement, or this is not your exact requirement please get back to us with the following details for further assistance. 

  • Share your complete code example.
  • Explain your complete requirement.

Let us know if you have any concerns.

Regards,
Praveenkumar G 


Marked as answer

JC Jonas Czeslik July 8, 2020 10:10 AM UTC

Yes! The filter statement is exactly what I needed and searched for! Thanks a lot, that makes it MUCH easier!
In the documentation (https://ej2.syncfusion.com/angular/documentation/grid/filtering), the operator contains is described as an operator that gets a string and checks, if the columns' data contain this given string and seemed to me to be bound to a single value. 



PG Praveenkumar Gajendiran Syncfusion Team July 9, 2020 02:38 PM UTC

Hi Jonas Czeslik,

We are happy that your issue has been resolved.
 

We have considered this documentation from your suggestion and we also have logged the documentation task for this(how to filter multiple values in the same column”). it will be available in any of our upcoming releases. 
 
Until then we appreciate your patience. 


regards,
Praveenkumar G 


Loader.
Up arrow icon