stavroskasidis/BlazorContextMenu

Lazy Loading based on clicked item?

Liero opened this issue · 1 comments

Liero commented

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...

Liero commented

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