sylar12
sylar12

Reputation: 107

agGrid Angular - add element (icon) on a row, column

I'd like to know how can I add an icon to a row, something like in the picture below. I did my research on google, but found nothing helpful.

https://i.sstatic.net/ZVIVw.jpg "example"

Upvotes: 1

Views: 9224

Answers (2)

Pratik Bhat
Pratik Bhat

Reputation: 7614

You should create a new field in your grid with Column def something like this -

{
    headerName: "",
    field: "icon",
    width: 100,
    cellRenderer: function(params) {
        return '<span><i class="fa fa-trash"></i></span>';
    }
}  

This will display an icon on the rightmost field.
However if you want your icon to respond to events or perform actions then you should look into implementing a cell Renderer component as described here.

Upvotes: 5

Christophe Chenel
Christophe Chenel

Reputation: 1921

Go to your css then:

cellStyle: { 'justify-content': "flex-end" }

or

cellStyle: {textAlign: "right"}

Upvotes: 0

Related Questions