React-data-grid: Add classNames in columns

Created on 6 Nov 2015  路  4Comments  路  Source: adazzle/react-data-grid

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
}
docs

Most helpful comment

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

All 4 comments

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

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.

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

Could cellClass default to the key?

Was this page helpful?
0 / 5 - 0 ratings