Skip to content

Commit 69963a1

Browse files
author
Tina C Lin (RD-TW)
committed
Add class name attribute into column property.
1 parent e63f1fa commit 69963a1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ rowKey | string or Function(record):string | 'key' | If rowKey is
335335

336336
Name | Type | Default | Description
337337
:--- | :--- | :------ | :----------
338+
className | String | | class name of the table cell.
338339
key | String | | Key of this column.
339340
title | React Node | | Title of this column.
340341
dataIndex | String | | Display field of the data record.

src/TableCell.jsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import classNames from 'classnames';
12
import React, { PureComponent } from 'react';
23
import PropTypes from 'prop-types';
34
import get from 'lodash.get';
@@ -18,9 +19,15 @@ class TableCell extends PureComponent {
1819
const { column, record } = this.props;
1920
const cName = column.dataIndex;
2021
const render = column.render;
22+
const className = column.className;
2123
let text = get(record, cName);
2224
return (
23-
<div className={styles.td}>
25+
<div
26+
className={classNames(
27+
className,
28+
styles.td
29+
)}
30+
>
2431
<div className={styles.tdContent}>
2532
{
2633
render ? render(text, record) : text

0 commit comments

Comments
 (0)