infinite-table / infinite-react

The modern React DataGrid for building apps — faster
https://infinite-table.com
73 stars 5 forks source link

groupBy column as function does not get applied #50

Closed georgeblue92 closed 2 years ago

georgeblue92 commented 2 years ago

I am trying to style the grouped column.

The style object is added only when groupBy.column is a static object. The following do not work.

groupBy: column: () ⇒ { style: () ⇒ ({ color: ‘red’ }) } // does not get applied 
groupBy: column: () ⇒ { style: { color: ‘red’ } } // does not get applied
groupBy: column: { style: { color: ‘red’ } } // works
roblotter commented 2 years ago

In the groupBy object, column cannot be a function - it needs to be an object. See example below:


const groupBy: DataSourceGroupBy<Developer>[] = [
  {
    field: 'country',
    column: {
      style: () => ({
        color: 'red',
      }),
    },
  },
  {
    field: 'city',
    column: {
      style: {
        color: 'blue',
      },
    },
  },
];