Hi
I want a small clarification on one of the use case related to IgrDataGrid (https://es.infragistics.com/products/ignite-ui-react/react/components/grids/data-grid/overview).
I have used IgrDataGrid, in that if we select any row with country USA and then apply filter on country column and removed data for USA. then that selected row for USA is not visible now on grid so we want that it should not be active.
So, for this I need to know how can we achieve that , If there is any solution for this please suggest as I need to implement this in my IgrDataGrid.
Hoping for a positive response.
Thanks!!!
Hello Shubham,
I have been investigating into the behavior you are reporting, and it appears that the activeCell of the grid should not remain for a row or cells that are filtered out. The selection can remain through the filter though.
In order to prevent a selection remaining on a row that is filtered out, you can check the grid’s actualDataSource property with the method indexOfItem. This method will return -1 for rows that are filtered out. If you find that this is the case, you can remove the item from the selectedItems collection of the grid. Therefore, you can remove items from the selection of the grid using the following code:
let item = this.grid.selectedItems.item(0);let index = this.grid.actualDataSource.indexOfItem(item);
if(index < 0){ this.grid.selectedItems.remove(item);}
I hope this helps. Please let me know if you have any other questions or concerns on this matter.
Hello Andrew,
Thank you for your response. Can you please suggest any suitable event in which we can add this code.
Let me know if some other information is required from our end.
Thanks.