简体   繁体   中英

How to change row color in ag-grid angular based on checkbox?

There are multiple checkboxes in a single row. The color of row should change based on the checkbox I check.

From the picture, suppose I check cell-(1,1) the color should be red or something.. If I check the cell(1,2) - another color. If I check the cell(1,3) - another color.

table with checkbox in each cell

One of the solutions could be to change the "cellStye" of all the columns when clicking the cell's checkbox. You can get the information from ag-grid docs [ https://www.ag-grid.com/javascript-grid-cell-styles/#cell-style] .

I have implemented a basic functionality which demonstrates your need. See the following plunkr -

https://next.plnkr.co/edit/n3Jc8jZWtOc4FVd4

It will give you an idea of how to implement it. Please update your code as per your logic. The goal is to demonstrate how to change the row color on the cell's checkbox click. Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM