Customizing scheduler with templates does not render anything




<ejs-schedule *ngIf='isLoading===false' #timelineSchedule width="100%" height="600px" [selectedDate]="startMinDate" [views]="views" [currentView]='currentView'
      [eventSettings]="eventSettings" [group]='group' [rowAutoHeight]='rowAutoHeight'>
      <e-resources>
        <e-resource field="entryID" title="Vehicle" name="Vehicles" [dataSource]="ownerDataSource"
          textField='vehicleName' idField='vehicleID' colorField='vehicleColor'>
        </e-resource>
      </e-resources>
    
      <ng-template #resourceHeaderTemplate let-data>
        <div class='template-wrap'>
          <div class="name">Test</div>
        </div>
      </ng-template>
    </ejs-schedule>

Attachment: Screenshot_2_408d0d31.zip

4 Replies 1 reply marked as answer

KK Konnos Kall August 6, 2020 09:32 AM UTC

Here the ts code

 @ViewChild('timelineSchedule')
  public scheduleObjScheduleComponent;
  public selectedDateDate = new Date();

  public currentViewstring = 'TimelineMonth';
  public viewsArray<string> = ['TimelineWeek''TimelineMonth'];
  public rowAutoHeightBoolean = true;
  public eventSettingsEventSettingsModel = {
    dataSource: []
  };
  public groupGroupModel = {
    resources: ['Vehicles']
  };

  public allowMultipleOwnerBoolean = true;
  public ownerDataSourceObject[] = [

  ];

  constructor(
    private schedulerServiceSchedulerService,
    
    private translateTranslateService,
    private notificationsNotificationsService,
    private routerRouter
  ) { }
  schedulerDataany[] = [];
  isLoadingboolean;



  public async getSchedulerData() {
    try {
      this.isLoading = true;
      const data = await this.schedulerService.getVehiclesbyReservations().toPromise();
      console.log(data);
      this.schedulerData = await data.vehicles;

      let i = 1;
      let reservationData = [];
      this.schedulerData.forEach(data => {
        let brand = data?.brand;
        let carModel = data?.carModel;
        let generationYear = data?.generationYear;
        let reservations = data?.reservations;
        this.ownerDataSource.push({ vehicleName: brand + " " + carModel + " " + generationYearvehicleID: ivehicleColor: '#500ade' });

        reservations.forEach(reservation => {
          reservationData.push({
            Id: i,
            Subject: brand + " " + carModel + " " + generationYear,
            StartTime: reservation.startDate,
            EndTime: reservation.endDate,
            PickUpLocation: reservation.pickupLocation,
            ReturnLocation: reservation.returnLocation,
            entryID: i
          })
        });


        i++;

      })
      this.eventSettings.dataSource = reservationData;
      console.log(this.eventSettings.dataSource);
      this.isLoading = false;
    } catch (error) {
      console.log(error);
    }

  }



BS Balasubramanian Sattanathan Syncfusion Team August 7, 2020 04:02 PM UTC

Hi Konnos Kall, 

Greetings from Syncfusion Support. 
 
We have tried to replicate your reported scenario “Customizing scheduler with templates does not render anything” at our side. But unfortunately, we are unable to reproduce it at our side. Since the Scheduler rendered properly. For your reference, we have prepared a sample based on that by making use of the resourceHeaderTemplate like the below code snippet. 
 
<ng-template #resourceHeaderTemplate let-data> 
  <div class='template-wrap'> 
    <div class="{{getEmployeeImage(data)}}"></div> 
    <div class="resource-details"> 
      <div class="resource-name">{{getEmployeeName(data)}}</div> 
      <div class="resource-designation">{{data.resourceData.designation}}</div> 
    </div> 
  </div> 
</ng-template> 
 

Kindly try and refer the above links and let us know the below details if the solution isn’t helpful. 
  • Replicate your problem in the above sample or
  • Share a sample (if possible) illustrating the problem which would help us to proceed further.

Regards, 
Balasubramanian S


KK Konnos Kall August 8, 2020 09:14 AM UTC

Hello. Thank you for your example. I copied and try it exactly with your data etc. Im getting an error here:
 public eventSettingsEventSettingsModel = {
    dataSource: <Object[]>extend([], resourceData.concat(timelineResourceData), nulltrue)
  };

With the following messages: 
core.js:6228 ERROR TypeError: exclude.indexOf is not a function
  
(anonymous) @ default~scheduler-scheduler-module~testscheduler-testscheduler-module.js:1
core.js:6228 ERROR Error: Uncaught (in promise): TypeError: exclude.indexOf is not a function
TypeError: exclude.indexOf is not a function
  

Also angular make the true in the end red and popups this message Argument of type 'true' is not assignable to parameter of type 'string[]'.



BS Balasubramanian Sattanathan Syncfusion Team August 11, 2020 06:42 PM UTC

Hi Konnos Kall, 

Thanks for the update. 

We have validated your shared code snippet and we suspect that the resource data source is not properly added inside the getSchedulerData method. And also we let you know that you have provided the rowAutoHeight property as true. So if the resource data is minimal(height is some pixel), the scheduler will be rendered look like shared screenshots. We have prepared a sample with your code snippet for your reference. 


Kindly refer to the above sample and let us know if this is helpful. 

Regards, 
Balasubramanian S 


Marked as answer
Loader.
Up arrow icon