gustavnavar / Grid.Blazor

Grid component with CRUD for Blazor (client-side and server-side) and ASP.NET Core MVC
GNU Lesser General Public License v2.1
703 stars 135 forks source link

Clicking a row in a subgrid causes the expanded main grid selection to collapse. #308

Open topherZa opened 3 years ago

topherZa commented 3 years ago

Describe the bug I have a grid with a subgrid and when I click on a row on the subgrid I want to show a modal which has more info about that item. I call StateHasChanged() to render the new component in the action that is fired by clicking on the row. That works fine except that the main grid then collapses, losing context of what item was expanded and which subitem was selected.

My guess at the problem: However the main grid knows a row is expanded (the GridPosition variable as far as I can tell) must be being updated when a sub grid row is clicked, and that has always happened, but because StateHasChanged would not normally have been called this problem hasn't been noticed before.

To Reproduce Steps to reproduce the behavior: I have updated the client side demo subgrids page to reflect the problem. Replace the code in the subgrids page demo with the below, then run the project, navigate to the subgrids page, expand a row by clicking the carat, click on a subgrid item row to fire the onclick event for the row, the main grid will collapase:

SubGrid.razor.txt

Expected behavior Whatever actions are executed but the main grid row that was expanded does not collapse automatically.

Additional context Is there any addtitional API that can be used like cGrid.SelectRow(rowIndex) to expand a row? As I can then use that as a short term solution to exand the row again after it's been collapsed automatically.

MarkEskander commented 1 year ago

I am facing the same Problem, still no solution!

topherZa commented 1 year ago

I am facing the same Problem, still no solution!

Yep I stopped using subgrids completely because of this issue

SolidDesignCore commented 1 year ago

Same Issue. Makes for very unfriendly SubGrids when working with lots of data.