Skip to content

Commit cd57f2f

Browse files
committed
data table values adaptaton I
1 parent 9703215 commit cd57f2f

File tree

2 files changed

+18
-23
lines changed

2 files changed

+18
-23
lines changed

app/assets/javascripts/dictionary/ResultTable.jsx

+13-19
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,22 @@ export default class ResultTable extends React.Component {
66
constructor(props){
77
super(props);
88
this.state = {
9-
rows : [{"id":1,"first_name":"William","last_name":"Elliott","email":"[email protected]",
10-
"country":"Argentina","ip_address":"247.180.226.89"},
11-
{"id":2,"first_name":"Carl","last_name":"Ross","email":"[email protected]",
12-
"country":"South Africa","ip_address":"27.146.70.36"},
13-
{"id":3,"first_name":"Jeremy","last_name":"Scott","email":"[email protected]",
14-
"country":"Colombia","ip_address":"103.52.74.225"}]
9+
rows : [{"text":"weather","translations":["Wetter", "Another"]}]
1510
};
1611
}
1712

1813
render() {
19-
return <Layout><Table
20-
height={40+((this.state.rows.length+1) * 30)}
21-
width={1150}
22-
rowsCount={this.state.rows.length}
23-
rowHeight={30}
24-
headerHeight={30}
25-
rowGetter={function(rowIndex) {return this.state.rows[rowIndex]; }.bind(this)}>
26-
<Column dataKey="id" width={50} label="Id" />
27-
<Column dataKey="first_name" width={200} label="First Name" />
28-
<Column dataKey="last_name" width={200} label="Last Name" />
29-
<Column dataKey="email" width={400} label="e-mail" />
30-
<Column dataKey="country" width={300} label="Country" />
31-
</Table></Layout>;
14+
return <Layout>
15+
<Table height={40+((this.state.rows.length+1) * 30)}
16+
width={1150}
17+
rowsCount={this.state.rows.length}
18+
rowHeight={30}
19+
headerHeight={30}
20+
rowGetter={function(rowIndex) {return this.state.rows[rowIndex]; }.bind(this)}>
21+
<Column dataKey="text" width={300} label="Text" />
22+
<Column dataKey="translations" width={850} label="Translations"
23+
cellRenderer={cellData => cellData.join()}/>
24+
</Table>
25+
</Layout>;
3226
}
3327
}

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@
3333
"bootstrap-sass": "^3.3.7",
3434
"css-loader": "^0.23.1",
3535
"extract-text-webpack-plugin": "^1.0.1",
36+
"fixed-data-table": "^0.6.3",
3637
"foundation-sites": "^6.2.3",
3738
"node-sass": "^3.10.0",
38-
"react": "^15.1.0",
39-
"react-cookie": "^0.4.7",
40-
"react-dom": "^15.1.0",
41-
"react-router": "^2.5.1",
39+
"react": "^15.3.2",
40+
"react-cookie": "^0.4.8",
41+
"react-dom": "^15.3.2",
42+
"react-router": "^2.8.1",
4243
"resolve-url-loader": "^1.6.0",
4344
"sass-loader": "^3.2.3",
4445
"style-loader": "^0.13.1",

0 commit comments

Comments
 (0)