Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. <div>
  2. <ngx-datatable
  3. #upcoming
  4. class="material"
  5. [headerHeight]="50"
  6. [footerHeight]="50"
  7. [rowHeight]="'auto'"
  8. [rows]="rows"
  9. [columns]="columns"
  10. [columnMode]="'flex'"
  11. [selected]="selected"
  12. [selectCheck]="selectUnselect"
  13. [selectionType]="'single'"
  14. [limit]="10"
  15. (select)='onSelect($event)'>
  16. </ngx-datatable>
  17. </div>
  18.  
  19. @Component({
  20. selector: 'rmis-upcomingstudies',
  21. templateUrl: './upcoming-studies.component.html',
  22. changeDetection: ChangeDetectionStrategy.OnPush,
  23. styleUrls: ['./upcoming-studies.component.css']
  24. })
  25. export class UpcomingStudiesComponent implements OnInit, OnChanges {
  26.  
  27. // ToDo: Check specific data types
  28. @Input() rows = [];
  29. @Input() temp = [];
  30. constructor(private studiesService: StudiesService,
  31. private exceptionService: ExceptionService,
  32. private cd: ChangeDetectorRef) {
  33. // Set up the column labels and properties for the upcoming study table
  34. this.columns = [
  35. {prop: 'protocol_number', name: 'Protocol Number', flexGrow: 1},
  36. {prop: 'start_date', name: 'Start Date', flexGrow: 1},
  37. {prop: 'end_date', name: 'End Date', flexGrow: 1},
  38. {prop: 'patient_count', name: 'Patient Count', flexGrow: 1},
  39. {prop: 'trial_country', name: 'Country', flexGrow: 1},
  40. ];
  41. }
  42.  
  43. ngOnInit() {
  44. this.getUpcomingStudies();
  45. }
  46.  
  47.  
  48.  
  49. /**
  50. * Get upcoming clinical trial studies data and assign to rows to be displayed on frontend.
  51. * @memberOf UpcomingStudiesComponent
  52. */
  53. getUpcomingStudies() {
  54. this.studiesService
  55. .getUpComingStudies()
  56. .subscribe(
  57. // the first argument is a function which runs on success
  58. (data) => {
  59. console.log('Data from backend-upcoming', data);
  60. this.temp = data['records'];
  61. this.rows = this.studiesService.util_to_cal_time(data['records']);
  62. // this.rows = data.records;
  63.  
  64. },
  65. // the second argument is a function which runs on error
  66. (err: HttpErrorResponse) => {
  67. this.exceptionService.errorResponse(err);
  68. },
  69. // the third argument is a function which runs on completion
  70. () => {
  71. this.cd.markForCheck();
  72. }
  73. );
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement