stavroskasidis / BlazorContextMenu

A context menu component for Blazor !

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lazy Loading based on clicked item?

Liero opened this issue · comments

Hi,

I have a listbox with contextmenu on the listboxitems.
How do I dynamically load some additional data from database based on where the contextmenu is triggered.

<ContextMenu Id="myMenu"> 
    @foreach (var subitem in CurrentItemSubitems)
    {
        <Item>
            EXP-@subitem.Id
        </Item>
    }
</ContextMenu>

 <Virtualize @ref="_listbox" Items="Items">
   <ItemContent>
       <ContextMenuTrigger MenuId="myMenu" Data="???">
          @context.Title
       </ContextMenuTrigger>
    </ItemContent>
</Virtualize>

Additionally, if would be nice, if this lazy loading worked for submenus as well...

I take it back. OnAppearing is the way to go.