EditContent after pressing Edit button in FooterTemplate
Hi,
I wanna do something in my code like you have in default editor.
How i can lunch this window, which show after pressing Edit button on Reccurence ?
I found in translate that is sometihng like EditContent
My code look like this,i wanna that windows if I press button on Reccurence and if i press it on regular event there will be OMoreDetailsClick launched:
<FooterTemplate>
<SfButton CssClass="e-event-edit" Content="Edycja"
OnClick="@(e => OnMoreDetailsClick(e, Data, true))"
disabled="@(isReadOnly ? true : false)">
</SfButton>
</FooterTemplate>
In OnItemSelected it look like this, but i dont know how to open that window:
case "EditOccurrence":
await this.ScheduleRef.OpenEditorAsync(this.EventData, CurrentAction.EditOccurrence);
break;
case "EditSeries":
List<WnioskiForm> events = await this.ScheduleRef.GetEventsAsync();
this.EventData = (WnioskiForm)events.Where(data => data.Id == this.EventData.RecurrenceID).FirstOrDefault();
await this.ScheduleRef.OpenEditorAsync(this.EventData, CurrentAction.EditSeries);
break;
Dear Bartek,
We've developed a sample using EditorTemplate that is similar to the appearance of the default editor. In this sample, when you click on a recurring event to edit it, it will either open the individual event editor or the series editor popup.
For your convenience we have prepared a sample, kindly check on the sample: https://blazorplayground.syncfusion.com/LjLfjqCBzubZDNAw
If this does not address your question, please let us know so we can correct any misunderstanding.
Regards,
Ram
Hi,
I tried it in my project and it dont work like in yours becouse im using ScheduleQuickInfoTemplates. Without footer in it, button change to default and popup show up.
I need to use my footer becouse it have some code logic.
Any ide how to use my footer + your popup?
<ScheduleQuickInfoTemplates>
<FooterTemplate>
@{
GrafikForm Data = (context as GrafikForm);
var isReadOnly = Data?.IsReadonly ?? false;
var isAddMode = (Data?.CreatedBy == null);
var priPraId = Data?.PRI_PraId;
var isAuthorized = IsCurrentUserAuthorized(priPraId);
var dzlDzlId = Data?.DZL_DzlId;
var isAuthorizedManager = DepartmentManagerCRUD();
var startTime = Data?.StartTime;
var disableStateReadOnly = false;
var disableStateAdd = false;
if (SignedInGroup.Contains("S_ADM_IT"))
{
isAuthorizedManager = Data?.DZL_DzlId;
}
}
<div class="cell-footer">
@if (priPraId != 0 && ((isAddMode && (isAuthorized || (isAuthorizedManager.HasValue && isAuthorizedManager.Value == dzlDzlId)))
|| (!isAddMode && (isAuthorized || (isAuthorizedManager.HasValue && isAuthorizedManager.Value == dzlDzlId)))))
{
@if (isAddMode)
{
var todayDate = DateTime.Now.Date;
var startTimeDate = startTime?.Date;
disableStateAdd = !(startTimeDate.HasValue && startTimeDate.Value >= todayDate);
<SfButton Content="Dodaj grafik" OnClick="@(e => OnMoreDetailsClick(e, Data, false))" Disabled="@disableStateAdd" />
}
else
{
disableStateReadOnly = isReadOnly ? true : false;
<SfButton CssClass="e-event-edit" Content="Edycja"
OnClick="@(e => OnMoreDetailsClick(e, Data, true))" Disabled="@disableStateReadOnly" />
@if (isAuthorizedManager.HasValue && isAuthorizedManager.Value == dzlDzlId)
{
<SfButton CssClass="e-event-delete" Content="Usuń" OnClick="@(e => OnDelete(Data))" Disabled="@disableStateReadOnly" />
}
}
}
</div>
</FooterTemplate>
</ ScheduleQuickInfoTemplates>
Hi Bartek,
Sample: https://blazorplayground.syncfusion.com/hZLzDAiJyRQbEMtD
UG: https://blazor.syncfusion.com/documentation/dialog/how-to/render-a-dialog-header-dynamically
Demo: https://blazor.syncfusion.com/demos/dialog/multiple-dialogs?theme=fluent
Based on your query, we suspect that you are trying to open a confirmation popup while clicking the "More Details" button on the quickInfoTemplate, especially when clicking on recurring events. If our assumption is correct, you can achieve your requirement by opening a custom dialog when clicking the "More Details" button on the quickinfo by checking the recurrenceRule, as shown in the shared code snippet below. An attached sample is provided for your reference. Try the shared sample and let us know if you need any further assistance.
[Index.razor]
|
<SfSchedule TValue="AppointmentData" @ref="ScheduleRef" CssClass="quick-info" Width="100%" Height="650px" SelectedDate="@(new DateTime(2024, 3, 10))"> <ScheduleQuickInfoTemplates> <FooterTemplate> @if ((context as AppointmentData).Id == default(int)) { <div class="cell-footer"> <SfButton Content="More Details" OnClick="@(e => OnMoreDetailsClick(e, (context as AppointmentData), false))"></SfButton> <SfButton Content="Add" IsPrimary="true" OnClick="@(e => OnAdd(e, (context as AppointmentData)))"></SfButton> </div> } else { <div class="event-footer"> <SfButton IsPrimary="true" Content="More Details" OnClick="@(e => OnMoreDetailsClick(e, (context as AppointmentData), true))"></SfButton> </div> } </FooterTemplate> </ScheduleQuickInfoTemplates> </SfSchedule>
<SfDialog IsModal="true" Header="@Header" Width="285px" Height="215px" ShowCloseIcon="true" @bind-Visible="Visibility"> <DialogTemplates> <Content>How would you like to change the appoinment in the series?</Content> </DialogTemplates> <DialogButtons> <DialogButton Content="Edit Event" IsPrimary="true" OnClick="@EditOccurrence" /> <DialogButton Content="Edit Series" OnClick="@EditSeries" /> </DialogButtons> </SfDialog>
@code{ AppointmentData TempEventData; private string Header = "Edit Event";
private bool Visibility { get; set; } = false;
private async Task EditOccurrence() { await this.ScheduleRef.OpenEditorAsync(TempEventData, CurrentAction.EditOccurrence); this.Visibility = false; }
private async void EditSeries() { List<AppointmentData> events = await ScheduleRef.GetEventsAsync(); TempEventData = (AppointmentData)events.Where(data => data.Id == this.TempEventData.RecurrenceID).FirstOrDefault(); await ScheduleRef.OpenEditorAsync(TempEventData, CurrentAction.EditSeries); this.Visibility = false; }
private async void OnMoreDetailsClick(MouseEventArgs args, AppointmentData data, bool isEventData) { await ScheduleRef.CloseQuickInfoPopupAsync(); if (isEventData == false) { private async void OnMoreDetailsClick(MouseEventArgs args, AppointmentData data, bool isEventData) { await ScheduleRef.CloseQuickInfoPopupAsync(); if (isEventData == false) { AppointmentData eventData = new AppointmentData { Id = new Random().Next(1000), Subject = SubjectRef.Value ?? "", StartTime = data.StartTime, EndTime = data.EndTime, Location = data.Location, Description = DescriptionRef.Value ?? "", IsAllDay = data.IsAllDay, RoomId = EventTypeRef.Value, RecurrenceException = data.RecurrenceException, RecurrenceID = data.RecurrenceID, RecurrenceRule = data.RecurrenceRule }; await ScheduleRef.OpenEditorAsync(eventData, CurrentAction.Add); } else { AppointmentData eventData = new AppointmentData { Id = data.Id, Subject = data.Subject, Location = data.Location, Description = data.Description, StartTime = data.StartTime, EndTime = data.EndTime, IsAllDay = data.IsAllDay, RoomId = data.RoomId, RecurrenceException = data.RecurrenceException, RecurrenceID = data.RecurrenceID, RecurrenceRule = data.RecurrenceRule };
if (data.RecurrenceRule != null) { this.Visibility = true; TempEventData = eventData; } else { await ScheduleRef.OpenEditorAsync(eventData, CurrentAction.Save); } } } }
|
Regards,
Venkatesh
- 3 Replies
- 3 Participants
- Marked answer
-
B“ Bartek “Egzennn” Wlodarczyk
- Mar 6, 2024 08:52 AM UTC
- Mar 14, 2024 04:50 PM UTC