Deepender Sharma
Deepender Sharma

Reputation: 490

Highlight row in ag grid on button click

I have a button outside the grid, on clicking of this button i am iterating the row nodes and doing a check whether the data is empty or not. If it is empty i want to highlight that row. Did not found anything which can give me any option to highlight the row in ag grid on button click.

Kindly help

Upvotes: 1

Views: 2387

Answers (1)

Deepender Sharma
Deepender Sharma

Reputation: 490

I found the answer for above:

In Component: may be in constructor

this.rowClassRules = {
  'invalid-row': (params) => {
    if (this.inValidRowNode && this.inValidRowNode.data.name === params.data.name) {
      return true;
    }
  }
};

On button click (in validation method), while iterating the node we need to set the data. I am setting in this way.

node.setDataValue('name', ' ');

In Html:

 <ag-grid-angular #agGrid rowSelection="multiple" [gridOptions]="gridOptions" [columnDefs]="gridColumnDefs" (gridReady)="onGridReady($event)"
     [rowClassRules]="rowClassRules">

Upvotes: 1

Related Questions