Created
August 17, 2015 17:10
-
-
Save gregturn/b4d561651b6997659786 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| render: function () { | |
| var employees = this.props.employees.map(employee => | |
| client({method: 'GET', path: employee._links.self.href}).then(response => | |
| <Employee key={response.entity._links.self.href} | |
| headers={response.headers} | |
| employee={response.entity} | |
| attributes={this.props.attributes} | |
| onUpdate={this.props.onUpdate} | |
| onDelete={this.props.onDelete}/> | |
| ) | |
| ); | |
| console.log(employees); | |
| var the_results = when.all(employees).then(results => { | |
| /* I got results right here */ | |
| }); | |
| var navLinks = []; | |
| if ("first" in this.props.links) { | |
| navLinks.push(<button key="first" onClick={this.handleNavFirst}><<</button>); | |
| } | |
| if ("prev" in this.props.links) { | |
| navLinks.push(<button key="prev" onClick={this.handleNavPrev}><</button>); | |
| } | |
| if ("next" in this.props.links) { | |
| navLinks.push(<button key="next" onClick={this.handleNavNext}>></button>); | |
| } | |
| if ("last" in this.props.links) { | |
| navLinks.push(<button key="last" onClick={this.handleNavLast}>>></button>); | |
| } | |
| return ( | |
| <div> | |
| <input ref="pageSize" defaultValue={this.props.pageSize} onInput={this.handleInput}/> | |
| <table> | |
| <tr> | |
| <th>First Name</th> | |
| <th>Last Name</th> | |
| <th>Description</th> | |
| <th></th> | |
| </tr> | |
| {employees} | |
| </table> | |
| <div> | |
| {navLinks} | |
| </div> | |
| </div> | |
| ) | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ahh. Maybe this.setState({/* fetched data*/}) once the data is fetched would the reactive way to go.