Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
how to clear the selected cell in igx-grid ?
posted

1. I want to clear this highlight cell which gets selected on click of that cell and prevent further events from that cell.

Eg-1: On click of some button in the screen, I want to clear all the selected cells.

Eg-2 :  I have a simple counting function that increase the count on cell click. For the first time selection of the cell it works, but again selecting the same cell , it doen't work., may be the cell is already selected, so how can I clear that cell selection or prevent the cell selection part from the whole grid in a way it should not affect the counting function.

Parents
No Data
Reply
  • 21795
    Offline posted

    Hello Raj,

    Grid selection is handled by IgxSelection service. This service is a singleton across the application. To clear any selection you should clear the related map in IgxSelection service. Selection of cells is recorded under this composite id:

    {igxGrid.id} + ‘-cell’

    To clear the cell selection call this line of code where you need it:

    yourIgxGridInstance.selection.set(yourIgxGridInstance.id + '-cell', null);

    Please note, removing the selected cell from the selection service may result in some unexpected results, like wrong handling of cell focus; wrong handling of cell editing; improper key navigation and so on.

    As right now there is no public method allowing you to clear cell selection I can strongly recommend you to log this as a new feature idea in our repository here.

    Please let me know if this solves your issue or if you need any further assistance on this matter.

Children
No Data