Skip to content

Commit 8f9ce7e

Browse files
authored
Merge pull request #106 from webdev-dev/master
FixedDataTable: Apply className to Cell
2 parents 9fb6b11 + 6a3e6e6 commit 8f9ce7e

3 files changed

Lines changed: 9 additions & 40 deletions

File tree

lib/FilteredTable/2/TableBody.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ var TableBody = function (_React$Component) {
150150
cell: function cell(props) {
151151
return _react2.default.createElement(
152152
_fixedDataTable.Cell,
153-
props,
153+
_extends({}, props, { className: item.className }),
154154
item.display(activeData[props.rowIndex])
155155
);
156156
},

src/FilteredTable/2/TableBody.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class TableBody extends React.Component {
120120
</Cell>
121121
}
122122
cell={props => (
123-
<Cell {...props}>
123+
<Cell {...props} className={item.className}>
124124
{item.display(activeData[props.rowIndex])}
125125
</Cell>
126126
)}

stories/FilteredTable/StoryPerformance.src

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,38 @@ const itemFormat = [
55
name: 'Person ID',
66
display: data => data.id,
77
width: 100,
8+
className: "personIdCell",
89
},
910
{
1011
name: 'First Name',
1112
display: data => data.first_name,
1213
sortingKey: data => data.first_name,
1314
width: 20,
15+
className: "firstNameCell",
1416
},
1517
{
1618
name: 'Last Name',
1719
display: data => data.last_name,
1820
width: 10,
21+
className: "lastNameCell",
1922
},
2023
{
2124
name: 'email',
2225
display: data => data.email,
2326
width: 10,
27+
className: "emailCell",
2428
},
2529
{
2630
name: 'gender',
2731
display: data => data.gender,
2832
width: 10,
33+
className: "genderCell",
2934
},
3035
{
3136
name: 'IP Address',
3237
display: data => data.ip_address,
3338
width: 10,
39+
className: "ipAddressCell",
3440
},
3541
{
3642
name: 'Actions',
@@ -75,47 +81,10 @@ const itemFormat = [
7581
</Button>
7682
</div>
7783
),
84+
className: "actionsCell",
7885
},
7986
];
8087

81-
const itemFormat2 = [
82-
{
83-
name: 'Person ID',
84-
display: data => data.id,
85-
width: 100,
86-
},
87-
{
88-
name: 'First Name',
89-
display: data => data.first_name,
90-
sortingKey: data => data.first_name,
91-
width: 20,
92-
},
93-
];
94-
/* Paginator is injected with an additional prop
95-
* which contains a method getOpenPage for generating
96-
* event handlers that change the page. */
97-
const PaginatorDisplay = ({ currentPage, numPages, getOpenPage }) => {
98-
const events = [];
99-
const maxShowingPages = 10;
100-
const lowerPageLimit = currentPage - maxShowingPages / 2;
101-
const upperPageLimit = currentPage + maxShowingPages / 2;
102-
for (let i = lowerPageLimit; i < upperPageLimit; i += 1) {
103-
const handler = getOpenPage(i);
104-
if (i === currentPage) {
105-
events.push(<a key={i}> {i} </a>);
106-
} else if (currentPage > numPages) {
107-
getOpenPage(numPages);
108-
} else if (handler) {
109-
events.push(
110-
<button key={i + 'b'} href="#" onClick={handler}>
111-
{i}
112-
</button>,
113-
);
114-
}
115-
}
116-
return <div>{events}</div>;
117-
};
118-
11988
/* A container is needed to fetch from API */
12089
class FilteredListContainer extends React.Component {
12190
constructor(props) {

0 commit comments

Comments
 (0)