File tree Expand file tree Collapse file tree 4 files changed +34
-5
lines changed Expand file tree Collapse file tree 4 files changed +34
-5
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,7 @@ const columns = [{
161
161
162
162
return (
163
163
<ReactTable
164
+ className='-striped -highlight'
164
165
data={data}
165
166
columns={columns}
166
167
defaultPageSize={10}
Original file line number Diff line number Diff line change @@ -112,8 +112,6 @@ class ControlledTable extends React.Component {
112
112
constructor() {
113
113
super()
114
114
this.sortChange = this.sortChange.bind(this)
115
- this.pageChange = this.pageChange.bind(this)
116
- this.pageSizeChange = this.pageSizeChange.bind(this)
117
115
this.state = {
118
116
sorting: [],
119
117
page: 0,
Original file line number Diff line number Diff line change @@ -88,23 +88,52 @@ const columns = [{
88
88
header: 'Name',
89
89
columns: [{
90
90
header: 'First Name',
91
- accessor: 'firstName'
91
+ accessor: 'firstName',
92
+ footer: (
93
+ <span><strong>Popular:</strong> {
94
+ _.first(
95
+ _.reduce(
96
+ _.map(
97
+ _.groupBy(
98
+ data, d => d.firstName
99
+ )
100
+ ),
101
+ (a, b) => a.length > b.length ? a : b
102
+ )
103
+ ).firstName}
104
+ </span>
105
+ )
92
106
}, {
93
107
header: 'Last Name',
94
108
id: 'lastName',
95
- accessor: d => d.lastName
109
+ accessor: d => d.lastName,
110
+ footer: (
111
+ <span><strong>Longest:</strong> {
112
+ _.reduce(
113
+ _.map(
114
+ _.groupBy(
115
+ data, d => d.lastName
116
+ ),
117
+ (d, key) => key
118
+ ),
119
+ (a, b) => a.length > b.length ? a : b
120
+ )}
121
+ </span>
122
+ )
96
123
}]
97
124
}, {
98
125
header: 'Info',
99
126
columns: [{
100
127
header: 'Age',
101
- accessor: 'age'
128
+ accessor: 'age',
129
+ footer: <span><strong>Average:</strong> {_.round(_.mean(_.map(data, d => d.age)))}</span>
102
130
}]
103
131
}]
104
132
105
133
// Display your table!
106
134
return (
107
135
<ReactTable
136
+ className='-striped -highlight'
108
137
data={data}
109
138
columns={columns}
110
139
defaultPageSize={10}
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ const columns = [{
77
77
// Display your table!
78
78
return (
79
79
<ReactTable
80
+ className='-striped -highlight'
80
81
data={data}
81
82
columns={columns}
82
83
defaultPageSize={10}
You can’t perform that action at this time.
0 commit comments