Action Menu in the New Datagrid Component

I’m trying to create an Action Menu in the new Datagrid component. Specifically, I want to have a three-dot icon in the last column of each row that shows a dropdown menu (e.g., “Edit”, “Delete”, etc.) when clicked.

However, when I try to add a Dropdown element inside a custom cell, the dropdown content is cut off or hidden behind the table rows, as shown in the screenshot below. I’ve tried adjusting z-index and overflow settings, but nothing works — the dropdown still appears underneath other rows or gets clipped.

Has anyone managed to implement a working Action Menu inside the new Datagrid?
What is the correct way to do this in Weweb?

1 Like

Did you manage to solve the issue? I am also looking for a solution to this problem.

1 Like

Im also wondering how to do that

Having an issue there aswell!

Same issue :frowning:

Found a No-Code Workaround (It’s Ugly)

First, create a new object variable with this schema:
{
“x”: 0,
“y”: 0,
“data”: “”,
“inside”: false,
“focus”: false
}

For the data grid, create a custom column with a button (NOT an icon). Remove the text from the button and enable the icon (remember to remove the margin on the icon). Add these 4 workflows:

On Blur:

  1. Pass through condition of not(ActionMenuVar.inside)
  2. Reset variable ActionMenuVar

On Click:
Change ActionMenuVar to
{
“x”: Event.x,
“y”: Event.y,
“data”: bindable data,
“inside”: true,
“focus”: true
}

On Mouse Enter:
Change ActionMenuVar (partial update) with path set to inside to true

On Mouse Leave:
Change ActionMenuVar (partial update) with path set to inside to false


Now, create your dropdown menu as a separate object outside of the data grid. Bind its conditional rendering/visibility to ActionMenuVar.focus and add 2 workflows:

On Mouse Enter:
Change ActionMenuVar (partial update) with path set to inside to true

On Mouse Leave:
Change ActionMenuVar (partial update) with path set to inside to false

For individual options in the action menu, add a workflow for On Click that:

  1. Does whatever custom code you want here
  2. Resets the ActionMenuVar (so it disappears)

Finally, make sure your dropdown position is set to Fixed, and bind the Top and Left variables:

  • Top: ActionMenuVar.y + “px”
  • Left: ActionMenuVar.x + “px”

This should give you the functionality you’re looking for, but it’s super ugly and might not work well on mobile. You might want to consider finding a JavaScript element with event listeners tied to elementIDs, though I know that gets tricky with data grids.

Also, the reason we need to do the focus step (which might feel redundant) is because sometimes onBlur runs faster than onClick, so the menu will disappear before your click workflow can execute.

If this is terrible for some reason, someone smarter should put it below as I am not working on production code.

1 Like

I haven’t worked with the new DataGrid element yet, but I built a custom version a while back, did something very similar and this is what I was going to suggest!

My popover menu uses the modal element (edit: you’ll notice I’m still using the old modal, but am working on migrating to the new elements and haven’t confirmed if it behaves any differently) , and use OnClick as opposed to mouseEnter/Leave but otherwise I’m passing the X and Y coordinates, storing the data bound to the selected row.