Darius
Darius

Reputation: 69

Is it possible to put borders around row groups in ag-grid

Has anyone put borders around there row groups to help make their grid easier to read? If so any guidance would be appreciated.

Upvotes: 1

Views: 1208

Answers (1)

NearHuscarl
NearHuscarl

Reputation: 81310

You can use getRowStyle to specify which rows you need to style. In your case, you can find if a row is a normal row or a row group by checking if RowNode.group is true.

AgGrid only use border-top to style row border. border-bottom of a row is actually the border-top of the row below it which means you can style the border-bottom of the row group visually by styling the border-top of the first child in the group (RowNode.firstChild).

Here is an example:

const getRowStyle = (params) => {
  const { node } = params;
  if (
    (node.rowIndex !== 0 && node.group) ||
    (!node.group && node.firstChild)
  ) {
    return { borderTop: "pink solid 1px !important" };
  }
}

Live Demo

Edit 63922354/is-it-possible-to-put-borders-around-row-groups-in-ag-grid

Upvotes: 1

Related Questions