react-data-grid icon indicating copy to clipboard operation
react-data-grid copied to clipboard

Add classNames in columns

Open markmus opened this issue 11 years ago • 4 comments

I dont know if this is possible right now but according to documentation there is still no way how I could add classNames or styles by columns.

Currently what I could do is to create a custom formatter, however it will be much more easy if we could add classNames upon declaration.

In example:

//Columns definition
var columns = [
{
  key: 'id',
  name: 'ID',
  locked : true,
  classNames: 'center'
},
{
  key: 'task',
  name: 'Title',
  width: 200
}

markmus avatar Nov 06 '15 07:11 markmus

Hi, You should be able to use the cellClass property of a column to set the class. I will add this to the documentation

malonecj avatar Nov 06 '15 16:11 malonecj

Is the cellClass also set on the header cell? Or is there another prop which can be used for this? I'm hoping to align right the cell text in columns with numeric data, but would also want to include the heading text.

alistairjcbrown avatar Dec 12 '15 18:12 alistairjcbrown

Added PR #170 to add the cellClass value to the class of the header cells as well

alistairjcbrown avatar Jan 19 '16 11:01 alistairjcbrown

Could cellClass default to the key?

txm avatar Jan 28 '16 10:01 txm