OpenAsync() does not open tooltip when triggered
I have a grid which has a column of type ListBox and I want to validate the objects inside the listbox and display "warning" messages in the form of a tooltip when a validation is triggered. Unfortunately no matter what i try i can not get the tooltip to appear when using OpenAsync()
<SfGrid @ref="sfRoomExam" Width="100%" DataSource="@modelRoomExam.RoomExams" EnableInfiniteScrolling="true">
<GridColumns>
<GridColumn Field="IdRoomExam" IsPrimaryKey="true" Visible="false"></GridColumn>
<GridColumn Type="ColumnType.CheckBox" Width="3%"></GridColumn>
<GridColumn HeaderText="Зала" Width="15%">
<Template Context="RoomExamContext">
@{
var context = (RoomExamContext as RoomExamVM);
}
<span>@context.Room.RoomName</span>
</Template>
</GridColumn>
<GridColumn HeaderText="Квестори" Width="65%">
<Template Context="RoomExamContext">
@{
var context = (RoomExamContext as RoomExamVM);
}
<SfTooltip @key="@context.IdRoom" @ref="@sfTooltips[context.IdRoom]" OpensOn="Custom">
<ChildContent>
<SfListBox @ref="sfQuaestorList" DataSource="@context.Room.Quaestors" Scope="combined-list" TItem="QuaestorVM" @attributes="listboxAttr" AllowDragAndDrop="true" Height="75px" TValue="string[]">
<ListBoxFieldSettings Text="QuaestorName" Value="IdQuaestorUser"></ListBoxFieldSettings>
<ListBoxEvents Dropped="(x => OnQuaestorsDropped(x, context))" TItem="QuaestorVM" TValue="string[]"></ListBoxEvents>
<ListBoxTemplates TItem="QuaestorVM">
<ItemTemplate Context="ListBoxContext">
@{
var listBoxContext = (ListBoxContext as QuaestorVM);
if (context.Room.Quaestors == null)
{
context.Room.Quaestors = new List<QuaestorVM>();
}
if (!context.Room.Quaestors.Any(x => x.IdQuaestorUser == listBoxContext.IdQuaestorUser))
{
context.Room.Quaestors.Add(listBoxContext);
}
}
@listBoxContext.QuaestorName
</ItemTemplate>
</ListBoxTemplates>
</SfListBox>
</ChildContent>
<ContentTemplate>
<ValidationMessage For="@(() => context.Room.Quaestors)"></ValidationMessage>
</ContentTemplate>
</SfTooltip>
@this.GetCaptionString("Required_Quaestor_Number") @context.Room.CountQuaestor
</Template>
</GridColumn>
</GridColumns>
</SfGrid>
@code{
private async void ValidateRoom(object? sender, ValidationRequestedEventArgs args)
{
this.roomMessageStore?.Clear();
foreach (var roomExam in modelRoomExam.RoomExams)
{
var toolTip = sfTooltips[roomExam.IdRoom];
if (roomExam.Room.Quaestors.Count == 0)
{
this.roomMessageStore?.Add(() => roomExam.Room.Quaestors, this.GetCaptionString("Полето 'Квестори' е задължително"));
await toolTip.OpenAsync();
}
else if (roomExam.Room.Quaestors.Count > roomExam.Room.CountQuaestor
|| roomExam.Room.Quaestors.Count < roomExam.Room.CountQuaestor)
{
this.roomMessageStore?.Add(() => roomExam.Room.Quaestors, this.GetCaptionString("Невалиден брой квестори"));
await toolTip.OpenAsync();
}
}
var messages = roomMessageStore[new FieldIdentifier(modelRoomExam, nameof(modelRoomExam.RoomExams))];
this.editContext.NotifyValidationStateChanged();
}
}
Hi Lyubo,
Greetings from Syncfusion support.
We have reviewed your query and understand that the Tooltip is not opening during validation. Upon reviewing your code, we noticed that the EditForm tag is used. We suggest using the EditForm tag to ensure proper validation and Tooltip functionality.
If we have misunderstood your query, please share the complete code and a video demonstrating the issue. These details will help us provide a prompt solution.
Sample: attached as zip file.
Please check the sample and let us know if you need any further assistance.
Best Regards,
Vishwanathan
Attachment: Tooltip_aa267b86.zip
- 1 Reply
- 2 Participants
-
LY Lyubo
- Dec 19, 2024 02:25 PM UTC
- Dec 20, 2024 12:55 PM UTC