Grid row / Column buttons events

Hello,

i've got data grid with hooked RowClick event and last column with buttons. Click on button also rises RowClick event. Is it possible to either:

a) hook RowClick on just some columns,
b) stop RadzenButton to propagate click event?

If i understand things correctly, it's not possible to instead of buttons Click event do @onclick:stopPropagation="..." because then i have no access to the row data object.

Also i tried:

td:last-child,
td:last-child > span {
	pointer-events: none;
	
	& * {
		pointer-events: auto;
	}
}

which will disable ability of clicking on last column but click on button will propagate event to the row regardless.

Maybe you can use CellClick instead RowClick and check the column:

    async Task CellClick(DataGridCellMouseEventArgs<Order> args)
    {
        if (args.Column.Property == "YourProperty")
        { 
            // Your code goes here
        }
    }

I think you can stop propagation and still use the row data easily.

<RadzenDataGridColumn ...>
    <Template Context="data">
      <RadzenButton @onclick:stopPropagation Click="@(() => OnClick(data))" />
   </Template>
</RadzenDataGridColumn>
1 Like

That is a possibility... but I have "standard" List component with it's events and translations and such and only thing specific for instances are column definitions, which I'm supplying by RenderFragment nested in <Columns>. So i would be then in all instances had to wire this event.

Would it be possible to enrich DataGridCellMouseEventArgs parameter of RowClick with property containging DataGridCellMouseEventArgs? To know clicked row and column would be beneficial in all kinds of scenarios.

Interesting, i'll try that, thank you.