angular-calendar
angular-calendar copied to clipboard
`Day view Scheduler` and `Drag to create` combined demo
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
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
@roboter Hey if you find a solution kindly share it
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
});
}