Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
147444 | Sep 11,2019 04:20 AM UTC | Sep 30,2019 06:15 AM UTC | Blazor | 11 |
![]() |
Tags: Scheduler |
public void PopupOpen(PopupOpenEventArgs<AppointmentData> args) {
if(args.Type == PopupType.Editor && args.Data.Id != 0)
{
args.Cancel = true; //to prevent default editor for appointments
var selectedAppointment = args.Data; //to get selected appointment object
}
} |
EjsSchedule<AppointmentData> ScheduleObj;
public List<CellClickEventArgs> cellDetails = new List<CellClickEventArgs>();
public List<DOM> elementDetails = new List<DOM>();
public string[] CustomClass = { "custom-class" };
public async void OnCellClicked(CellClickEventArgs args)
{
if (args.Event.CtrlKey == true) //to check whether CTRL key is pressed
{
args.Cancel = true; //to prevent default action
args.Element.AddClass(CustomClass); // to add the background color for selected cells
elementDetails.Add(args.Element);
CellClickEventArgs cell = await this.ScheduleObj.GetCellDetails(args.Element); //to get the current cell details
cellDetails.Add(cell);
}
}
public void OnButtonClick()
{
for (int i = 0; i < cellDetails.Count; i++)
{
Random rnd = new Random();
int Id = rnd.Next(1000);
List<AppointmentData> newData = new List<AppointmentData>();
newData.Add(new AppointmentData
{
Id = Id,
Subject = "Added events",
StartTime = cellDetails[i].StartTime,
EndTime = cellDetails[i].EndTime
});
this.ScheduleObj.AddEvent(newData); //to add appointments to the scheduler
elementDetails[i].RemoveClass(CustomClass); // to remove the background color for selected cells
}
cellDetails.Clear();
} |
.e-schedule .e-timeline-month-view .e-work-cells.custom-class,
.e-schedule .e-timeline-view .e-work-cells.custom-class {
background: #e0e0e0;
} |
.e-schedule .e-timeline-month-view .e-appointment.custom-class,
.e-schedule .e-timeline-view .e-appointment.custom-class {
background: #f8a398;
} |
<EjsSchedule @ref="ScheduleObj" TValue="AppointmentData" CssClass="my-schedule" ModelType="@Model" Width="100%" Height="650px" SelectedDate="@(new DateTime(2019, 1, 10))">
……
….
.my-schedule.e-schedule .e-timeline-view .e-resource-cells,
.my-schedule.e-schedule .e-timeline-month-view .e-resource-cells,
.my-schedule.e-schedule .e-timeline-view .e-work-cells,
.my-schedule.e-schedule .e-timeline-month-view .e-work-cells {
height: 75px;
}
.my-schedule.e-schedule .e-timeline-view .e-appointment,
.my-schedule.e-schedule .e-timeline-month-view .e-appointment
{
height: 73px;
} |
<style>
.my-schedule.e-schedule .e-timeline-view .e-resource-cells,
.my-schedule.e-schedule .e-timeline-month-view .e-resource-cells,
.my-schedule.e-schedule .e-timeline-view .e-work-cells,
.my-schedule.e-schedule .e-timeline-month-view .e-work-cells {
height: 100px;
}
.my-schedule.e-schedule .e-timeline-view .e-resource-cells.e-parent-node,
.my-schedule.e-schedule .e-timeline-month-view .e-resource-cells.e-parent-node,
.my-schedule.e-schedule .e-timeline-view .e-work-cells.e-resource-group-cells,
.my-schedule.e-schedule .e-timeline-month-view .e-work-cells.e-resource-group-cells {
height: 40px;
}
</style>
..
public async void OnEventRendered(EventRenderedArgs<AppointmentData> args)
{
var style = await args.Element.GetAttribute("Style");
string height = style.ToString() + "height:98px;"; //reduce two pixels from the height of work cells for borders
args.Element.SetAttribute("Style", height);
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.