Utilize the expert capabilities within #dateHeaderTemplate in the Angular component schedule by Syncfusion

I am trying to access the template #dateHeaderTemplate in order to retrieve the ID of the professional who is scheduled to attend the appointment. This information is needed to display the start and end times of the day in the header.

By visiting this link, you can see that we have the ability to customize the elements in the #dateHeaderTemplate header.

If there is a method similar to obtaining the percussion value as in the #resourceHeaderTemplate, I should be able to retrieve the professional ID.

component.ts:

  public getStartTimeAndEndTime(data): string {

    // values containing data
    // {date: Mon Oct 21 2019 00:00:00 GMT-0300 (Brazil Standard Time), type: "dateHeader"}

    // Need to identify which professional is being covered here

    return '13:30 - 18:30';
  }

  public getDateHeaderText(value: Date): string {
    return this.instance.formatDate(value, { skeleton: 'Ed' });
  }

component.html:

<ng-template #resourceHeaderTemplate let-data>

   <!-- Professional ID displayed here -->

    <div class='template-wrap'>
        <div class="avatar resource-image {{getDoctorImage(data)}}"></div>
        <div class="resource-details">
            <div class="resource-name">{{getDoctorName(data)}}</div>
            <div class="h6">{{ getEspecialidadeName(data) }}</div>
            <div class="h5 text-bold" [ngClass]="{'green-fg': getDoctorStatus(data).type === 'atendendo',
             'secondary-text': getDoctorStatus(data).type === 'away'  }">{{ getDoctorStatus(data).text }}</div>
        </div>
    </div>
</ng-template>

<ng-template #dateHeaderTemplate let-data>
    <div fxLayout="column" fxLayoutAlign="center center">
        <div class="date-text h3 text-bold">{{getDateHeaderText(data.date)}}</div>
        <div class="h6">{{getStartTimeAndEndTime(data)}}</div>
        <!-- 
            In addition to the date, also need the professional ID from ng-template #resourceHeaderTemplate-->
    </div>
</ng-template>
<e-resources>
    <e-resource field='DoctorId' title='Doctor' name='Doctors' [dataSource]='resourceDataSource'
        textField='text' idField='id' colorField='color' workDaysField='workDays' startHourField='startHour'
        endHourField='endHour'>
    </e-resource>

Answer №1

Welcome to Syncfusion.

Instead of trying to retrieve the resource id within the dateHeaderTemplate, we recommend using the scheduler's renderCell event to show the resource start and end hour on the date header. Check out the sample below for reference.

https://stackblitz.com/edit/angular-mf9hdq-au5ue2?file=app.component.ts

onRenderCell(args: RenderCellEventArgs): void {

  // Grabbing the resource data while rendering date header cells
  if (args.elementType == 'dateHeader') {
    let resData: any = this.scheduleObj.getResourcesByIndex(parseInt(args.element.getAttribute('data-group-index'), 10));
    let ele: HTMLElement = createElement('div', {
      innerHTML: ""+resData.resourceData.startHour +" - "+resData.resourceData.endHour,
      className: 'res-name', styles: 'padding-top: 5px'
    });
    (args.element).appendChild(ele);
  }
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it possible for me to download npm locally using the command line? I am looking to install an older version of npm for a project that requires it

I currently have two Angular projects on my computer: The first project is built in Angular 14 and connected to Java. The installations of npm and ng are carried out using Maven plugins. Here is an example of the Maven plugins being called with configurat ...

Can the nested package within the package-lock.json file be updated?

Take for instance the make-fetch-happen package within npm/node-gyp/node_modules/ directory. I am looking to update the make-fetch-happen package due to the http-cache-semantics v4.1.0 version being marked as unsafe in this location. Alternatively, is it ...

The function RegisterOnChange is not a valid function

I utilized FormBuilder(fb) to create this form. this.serviceRecordForm = this.fb.group({ client: [], serviceRecordItem: this.fb.group({ productStatus: [''], password: [''], hasBackup: ...

Creating a dynamic table in HTML and Angular is a simple process that involves utilizing the

How can I create an HTML table dynamically without knowing the template of each row in advance? Sometimes it may have 2 columns, sometimes 4... I am looking for something like this: <div> <h1>Angular HTML Table Example</h1> < ...

When the form is submitted, the HTMLCollection becomes void

I am facing an issue with a form that always seems to be invalid. To troubleshoot, I tried running this command in my web browser to identify the invalid fields: document.getElementsByClassName('ng-invalid'); However, the HTMLCollection returned ...

Failed deployment of a Node.js and Express app with TypeScript on Vercel due to errors

I'm having trouble deploying a Nodejs, Express.js with Typescript app on Vercel. Every time I try, I get an error message saying "404: NOT_FOUND". My index.ts file is located inside my src folder. Can anyone guide me on the correct way to deploy this? ...

Utilizing GroupBy in RxJs for an Observable of Objects数组

I am working with entries of type Observable<Event[]>, and they are structured as follows: [{ "_id": 1, "_title": "Test Event 1", "_startDate": "2019-05-29T07:20:00.000Z", "_endDate": "2019-05-29T08:00:00.000Z", "_isAllDay": false }, ...

Working with Typescript and JSX in React for event handling

I'm currently facing an issue with updating the state in a React component I'm developing using TypeScript (React with Addons 0.13.3, Typescript 1.6.0-dev.20150804, definition file from ). /// <reference path="react/react-addons.d.ts" /> i ...

Clearing a leaflet layer after a click event: Step-by-step guide

When working with my map, I attempt to toggle the layer's selection using a mouse click. Initially, my map looks like this: Upon clicking a layer, my goal is to highlight and select it: If I click on a previously selected layer again, I want to dese ...

There is no way for me to view my loader more than once

I am currently utilizing @ng-bootstrap/ng-bootstrap for pagination and ngx-loading to handle loader display. Both of these components are performing well in my application. Here is the code snippet for pagination: {{ loading }} <ngb-pagination [colle ...

How can I limit generic types to only be a specific subtype of another generic type?

Looking to create a data type that represents changes in an object. For instance: const test: SomeType = { a: 1, b: "foo" }; const changing1: Changing<SomeType> = { obj: test, was: { a: test.a }, now: { a: 3 ...

Issue encountered in Angular 16: angular-slickgrid is reporting that property 'detail' is not found on type 'Event'

Currently, I am working on integrating angular-slickgrid v6 with Angular 16. In my code snippet, I am using (onClick)="onCellClicked($event.detail.eventData, $event.detail.args)" to retrieve the selected row. However, I encountered an error message stating ...

Is it possible to modify a portion of the zod schema object according to the value of a

My form consists of several fields and a switch component that toggles the visibility of certain parts of the form, as shown below: <Field name="field1" value={value1} /> <Field name="field2" value={value2} /> &l ...

Having trouble incorporating a canvas created with html2canvas into the addHTML() method of jspdf

I am working on developing an application using angular5 and I am attempting to incorporate HTML by utilizing the jspdf.addHTML() function in conjunction with html2canvas. const content = this.vc_print_section.nativeElement; html2canvas(content).then(can ...

Setting up a new package through JPSM installation

I utilize jspm in my web application. My goal is to install the npm:angular2 package without needing to set it up in the config.js file. Instead of loading the angular2 module via jspm, I manually added the angular2 library like this: <script src="jspm ...

How to showcase MongoDB data directly on the homepage

Looking for advice on how to display MongoDB database records on the front end of my website using Express. Each record has a category, and I want to organize and display them accordingly. As a beginner, any tips or suggestions would be greatly appreciat ...

Passing a service into a promise in Angular 2 using TypeScript

Is there a way to pass a service into a promise? I am currently working on a promise that will only resolve once all the http requests are complete. However, I am facing an issue where this.jiraService is undefined. Is there a method to pass it to the co ...

TS7030: In Angular13, ensure that all code paths within the guard and canActivate methods return a value

Having trouble using guards for an unlogged user and constantly facing errors. Error: TS7030 - Not all code paths return a value. Below is my auth.guard.ts file: import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree} from &a ...

Angular 9: Implementing a synchronous *ngFor loop within the HTML page

After receiving a list of subjects from the server, exercises are taken on each subject using the subject.id (from the server) and stored all together in the subEx variable. Classes are listed at the bottom. subjects:Subject[] temp:Exercise[] = [] s ...

Is there a way to replicate the tree structure of an array of objects into a different one while modifying the copied attributes?

Is there a way to replicate the tree structure of an array of objects to another one in TypeScript, with different or fewer attributes on the cloned version? Here's an example: [ { "name":"root_1", "extradata&qu ...