admin管理员组

文章数量:1289425

I developed a context menu in Blazor with DevExpress to make a copy of selected record. For doing that I followed the DevExpress instructions:

video

code in github

The example has only the standard menu items of context menu, but I have only a custom item: "Copy Record". I think for this problem it make no difference because index is selected by clicking on grid.

The problem is it return the id of the record which is on top of the selected record is. with selected record I mean the record on which user is click on UI.

Code in list of data is:

<DxGrid @ref="_grid"
  Data="@Data"
  AllowSort="true"
  PageSize="15" 
  ShowSearchBox="true"
  SearchBoxNullText="Suche"
  ShowFilterRow="true"
  ShowGroupPanel="true"
  AutoExpandAllGroupRows="true"
  ColumnResizeMode="GridColumnResizeMode.NextColumn"
  AllowSelectRowByClick="true"
  CustomizeElement="Grid_CustomizeElement" 
  @oncontextmenu:preventDefault
  >
</DxGrid>
<GridContextMenuContainer Grid="_grid" @ref="ContextMenuContainer" />
@code {
     private IGrid? _grid;
     GridContextMenuContainer ContextMenuContainer { get; set; }

     void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
     {
          if (GridContextMenuHelper.IsContextMenuElement(e.ElementType))
          {
              e.Attributes["oncontextmenu"] = EventCallback.Factory.Create<MouseEventArgs>(
                   this,
                  async mArgs => await ContextMenuContainer.Grid_ContextMenu(e, mArgs)
              );
          }
    }
}

本文标签: devexpressIncorrect visibleindex in context menu of Blazor DX GridStack Overflow