Guest User

Untitled

a guest
Sep 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. render() {
  2.  
  3. if(defect.defect_status=='open') {
  4. statusRender = <button key={index} data-id={defect.id} onClick = {() => this.showAlert(defect.defect_id)}>{defect.defect_status}</button>;
  5. } else {
  6. statusRender = {defect.defect_status};
  7. }
  8. return (
  9. <div>
  10. <table className="table table-bordered table-hover">
  11. <thead>
  12. <tr>
  13. <th>Defect ID</th>
  14. <th>Category</th>
  15. <th>Description</th>
  16. <th>Priority</th>
  17. <th>Status</th>
  18. </tr>
  19. </thead>
  20. <tbody>
  21. {this.state.defectList.map((defect,index) =>{
  22. return(
  23. <tr key={index}>
  24. <td> {defect.defect_id} </td>
  25. <td>{defect.defect_category}</td>
  26. <td>{ defect.defect_description}</td>
  27. <td>{ defect.defect_priority}</td>
  28. <td> {statusRender}
  29. </td>
  30. </tr>
  31. );
  32. })
  33. }
  34. </tbody>
  35. </table>
  36. </div>
  37. )
  38.  
  39.  
  40. }
  41. }
  42.  
  43. {this.state.defectList.map((defect,index) => {
  44. return (
  45. <tr key={index}>
  46. <td> {defect.defect_id} </td>
  47. <td>{defect.defect_category}</td>
  48. <td>{ defect.defect_description}</td>
  49. <td>{ defect.defect_priority}</td>
  50. <td>
  51. {
  52. defect.defect_status === 'open'
  53. ? <button key={index} data-id={defect.id} onClick = {() => this.showAlert(defect.defect_id)}>{defect.defect_status}</button>;
  54. : defect.defect_status;
  55. }
  56. </td>
  57. </tr>
  58. );
  59. })
  60. }
Add Comment
Please, Sign In to add comment