Skip to content

Commit

Permalink
Date change events are added
Browse files Browse the repository at this point in the history
  • Loading branch information
Gokce Ozkan committed Mar 28, 2024
1 parent b3f3a72 commit c4f18de
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions SiemensIXBlazor/Components/DatePicker/DatePicker.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public partial class DatePicker
[Parameter]
public EventCallback<DatePickerResponse?> DateRangeChangeEvent { get; set; }
[Parameter]
public EventCallback<DatePickerResponse?> DateChangeEvent { get; set; }
[Parameter]

public EventCallback<DatePickerResponse> DateSelectEvent { get; set; }

private BaseInterop _interop;
Expand All @@ -47,6 +50,7 @@ protected async override Task OnAfterRenderAsync(bool firstRender)
{
_interop = new(JSRuntime);

await _interop.AddEventListener(this, Id, "dateChange", "DateChange");
await _interop.AddEventListener(this, Id, "dateRangeChange", "DateRangeChange");
await _interop.AddEventListener(this, Id, "dateSelect", "DateSelect");
}
Expand All @@ -61,6 +65,16 @@ public async void DateRangeChange(JsonElement data)
await DateRangeChangeEvent.InvokeAsync(jsonData);
}


[JSInvokable]
public async void DateChange(JsonElement data)
{
string jsonDataText = data.GetRawText();
DatePickerResponse? jsonData = JObject.Parse(jsonDataText)
.ToObject<DatePickerResponse>();
await DateChangeEvent.InvokeAsync(jsonData);
}

[JSInvokable]
public async void DateSelect(JsonElement data)
{
Expand Down

0 comments on commit c4f18de

Please sign in to comment.