Hello all, in my blazor server application i use the SignalR for update dinamically the razor pages of my app.
When i create a component on a page wich i show on a syncfusion kanban component in another page, i call the SignalR method.
In the page with the Kanban Component i connect to the SignalR connection and each time i raise a specific method, the page should update.It seems to work for everything but the kamban component (it not refresh)
Here i save the component
public async Task<IDataResult<Ticket>> SaveTicketAsync(Ticket ticket) { var result = await _ticketRepository.AddAsync(ticket); if (result.Success) { ticket.Id = result.GetData().Id; await _hubContext.Clients.All.RefreshGenericTickets(); return new GoodDataResult<Ticket>(ticket); } return new BadDataResult<Ticket>(result.ConcatenatedErrorMessages); }
here is my blazor component
SfKanban<KanBanTicket> KanbanBoard;
protected async override Task OnInitializedAsync() { var result = await _viewModel.LoadUIData(); if (!result.Success) { ErrorMessage = result.ConcatenatedErrorMessages; } MyDatasource = _viewModel.KanbanTickets; var hubConnection = new HubConnectionBuilder() .WithUrl(_navigation.ToAbsoluteUri("/SignalRHub")) .Build(); hubConnection.On("RefreshGenericTickets", async () => { await InvokeAsync(async () => { MyDatasource = null; //reload data when signalr receive the "refreshGenericTickets" method await _viewModel.LoadUIData(); MyDatasource = _viewModel.KanbanTickets; await KanbanBoard.RefreshAsync(); ErrorMessage = "test"; this.StateHasChanged(); } ); }); await hubConnection.StartAsync(); }
<SfKanban CssClass="kanban-overview" @ref="KanbanBoard" TValue="KanBanTicket" KeyField="State" @bind-DataSource="MyDatasource" ID="kanbanTicket" Height="70vh" AllowDragAndDrop="false"> <KanbanColumns> @foreach (Syncfusion.Blazor.Kanban.ColumnModel item in columnData) { <KanbanColumn HeaderText="@item.HeaderText" KeyField="@item.KeyField" AllowToggle="@item.AllowToggle"> <Template> @{ KanbanColumn column = (KanbanColumn)context; <div class="header-template-wrap"> <div class="header-icon e-icons @column.KeyField[0]"></div> <div class="header-text">@column.HeaderText</div> </div> } </Template> </KanbanColumn> } </KanbanColumns> <KanbanDialogSettings> <Template> @{ KanBanTicket data = (KanBanTicket)context; } @data.DateCreation.ToString() </Template> </KanbanDialogSettings> <KanbanCardSettings HeaderField="Title" ContentField="DisplayType" GrabberField="Color"> <Template> @{ KanBanTicket data = (KanBanTicket)context; <CoverTicketBacklogDetail Data="data"/> } </Template> </KanbanCardSettings> <KanbanEvents TValue="KanBanTicket" CardClick="@OnCardSingleClick" CardDoubleClick="OnCardSingleClick" DialogOpen="@OnDialogOpen"></KanbanEvents> </SfKanban> <GenericTicketDialog @ref="selectedTicketDialog"/> } <p>@ErrorMessage</p>
The errormessage (as test) update correctly, just the kanban board not update. if i press F5 to reload manually the browser, it update correctly
thank you in advance..
Maurizio
Hello!
now seems to work fine!
thank you very much for your fast action!
best regards
Maurizio