Estoy usando una tabla AntDesign con una selección. Si selecciono a una persona y uso el botón derecho del mouse, quiero mostrar la ventana emergente de la fila seleccionada. Ya he deshabilitado el menú contextual si uso el botón derecho del mouse.
¿Cómo es posible mostrar exactamente el popover de la fila seleccionada?
<div oncontextmenu="return false;" @onmouseup="HandleMouseUp"> <AntDesign.Table DataSource="@persons" TItem="Person" @bind-SelectedRows="@selectedRows"> <Selection Key="@(context.Id.ToString())"/> <Column Title="Name"> @(context.Name) </Column> <Column Title="Surname"> @(context.Surname) </Column> <ActionColumn Title="Settings"> <Popover Trigger="@(new Trigger[] { Trigger.Click})"> <ContentTemplate> <Button Type="@ButtonType.Text" @onclick="@(() => DeletePersonAsync(context))" /> Delete </Button> </ContentTemplate> <ChildContent> <Button type="primary" @onclick="@(() => HandleMoreActionsClicked(context))">Actions</Button> </ChildContent> </Popover> </ActionColumn> </AntDesign.Table> </div> @code { private List<Person> persons = new(); private IEnumerable<Person> selectedRows = new(); protected override void OnInitialized() { persons = GetListOfPersons(); } private void HandleMouseUp(MouseEventArgs args) { if (args.Button == 2) { if(selectedRows.Count() == 0) { return; } else if(selectedRows.Count() == 1) { var currentRow = selectedRows.First(); //open Popover for this row } else { //TODO } } } private async Task DeletePersonAsync(Person person) { await Client.DeletePersonAsync(person); } private void HandleMoreActionsClicked(Person clickedRowItem) { if (!selectedRows.Any(r => r.Id == clickedRowItem.Id)) { selectedRows = new List<Person> { clickedRowItem }; } }
}