Skip to content

Commit

Permalink
Merge pull request #2 from russell-ingram/master
Browse files Browse the repository at this point in the history
Updating Docs to work with new Column Resizing feature in SuperTable
  • Loading branch information
russell-ingram authored Jan 6, 2019
2 parents a3db7d5 + 060e732 commit 08bad0d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fdns-ui-react-docs",
"description": "This is the documentation React app for the FDNS UI React Library",
"version": "1.0.0",
"version": "1.0.1",
"author": "Centers for Disease Control and Prevention (http://github.com/CDCgov)",
"license": "Apache-2.0",
"repository": {
Expand All @@ -10,7 +10,7 @@
},
"dependencies": {
"ajv": "^6.5.1",
"fdns-ui-react": "^0.5.8",
"fdns-ui-react": "0.5.8",
"prop-types": "^15.6.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
Expand Down
17 changes: 15 additions & 2 deletions src/docs/DocSuperTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ const data = messages.slice(0).splice(0,25);
class DocSuperTable extends Component {
constructor(props) {
super(props);
this.state = {
headers: headers
};
this.handleDetail = this.handleDetail.bind(this);
this.handleColumnResize = this.handleColumnResize.bind(this);
}

handleDetail(item) {
Expand All @@ -35,13 +39,22 @@ class DocSuperTable extends Component {
return 226;
}

// column resizing event for the table column
handleColumnResize(newColumnWidth, columnKey) {
headers[columnKey].width = newColumnWidth;
this.setState({
headers
})
}

render() {
const sampleComponent = (
<SuperTable data={data}
headers={headers}
<SuperTable data={data}
headers={this.state.headers}
onDetail={this.handleDetail}
getWidth={this.getWidth}
getHeight={this.getHeight}
onColumnResize={this.handleColumnResize}
showErrorsAndWarnings={false}
ref="table" />
);
Expand Down

0 comments on commit 08bad0d

Please sign in to comment.