angular-calendar icon indicating copy to clipboard operation
angular-calendar copied to clipboard

`Day view Scheduler` and `Drag to create` combined demo

Open roboter opened this issue 4 years ago • 3 comments
trafficstars

Is your feature request related to a problem? Please describe

A Day view with Drag to create.

I tried to combine Day view Scheduler and Drag to create but in drag to create day position is calculated using with and height of a DIV

Describe the solution you'd like API to get current Column ID in mouse drag

  (mousedown)="customMouseDown.emit({segment:segment, event: $event, user:user})"

user - undefined now

get a row Id or User object

Describe your use case for implementing this feature

Or some other way to get current ROW or User

Additional context

roboter avatar Aug 04 '21 08:08 roboter

Thanks so much for opening an issue! If you'd like me to give priority to answering your issue or would just like to support this project, then please consider sponsoring me

matts-bot[bot] avatar Aug 04 '21 08:08 matts-bot[bot]

@roboter Hey if you find a solution kindly share it

abdulrahman5020 avatar Oct 13 '21 12:10 abdulrahman5020

Very hacky solution: I added data-attributes, and indexes and based on that I can get user ID

<div class="cal-week-view" role="grid">
  <div class="cal-day-headers" role="row">
    <div class="cal-header" *ngFor="let user of users; trackBy: trackByUserId; index as i;" [attr.data-index]="i" [attr.data-masterId]="user.id" tabindex="0" role="columnheader">
      <b>{{ user.name }}</b>
    </div>
  </div>
<div class="cal-day-column" data-id="{{column}}" *ngFor="let column of view.hourColumns; trackBy: trackByHourColumn; index as i;" [attr.data-index]="i" >
 (mousedown)="startDragToCreate(segment, $event, {hour, trackByHour, column, hour, user, i })"
  
   startDragToCreate(segment, $event, segmentElement) {
    const header = document.querySelectorAll('.cal-header');
    this.customEvent.emit({
      date: segment.date,
      masterId: header[segmentElement.i].getAttribute('data-masterId'),
      segmentElement,
      y: $event.y
    });
  }

roboter avatar Oct 20 '21 14:10 roboter