Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MudTable - GroupBy - Virtualize to True not taking any effect #4008

Closed
2 tasks done
Gopichandar opened this issue Feb 21, 2022 · 1 comment · Fixed by #4045
Closed
2 tasks done

MudTable - GroupBy - Virtualize to True not taking any effect #4008

Gopichandar opened this issue Feb 21, 2022 · 1 comment · Fixed by #4045

Comments

@Gopichandar
Copy link
Contributor

Bug type

Component

Component name

MudTable

What happened?

When I have a "GroupDefinition" and if I enable Virtualization by "Virtualize=true", it was NOT applying virtualization here

Expected behavior

Setting "Virtualize=true" with "GroupDefinition" should apply virtualization

Reproduction link

https://try.mudblazor.com/snippet/cOmQuQwbbbNgiQqH

Reproduction steps

  1. On click the run here in Try Mudblazor - https://try.mudblazor.com/snippet/cOmQuQwbbbNgiQqH
  2. You might see loading the row might freeze the whole screen
  3. It will take more the 15 sec wait time to render
    ...

Relevant log output

No response

Version (bug)

6.0.5

Version (working)

No response

What browsers are you seeing the problem on?

Chrome

On what operating system are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Gopichandar Gopichandar changed the title MudTable - GroupBy - Virtualize not taking any effect MudTable - GroupBy - Virtualize to True not taking any effect Feb 21, 2022
@Gopichandar
Copy link
Contributor Author

Gopichandar commented Feb 21, 2022

I can see the issue is with the the code code snippet that doesn't has Virtualize.

https://github.com/MudBlazor/MudBlazor/blob/dev/src/MudBlazor/Components/Table/MudTable.razor#:~:text=%40foreach%20(T%20item,OnRowCheckboxChanged(value%2C%20x)%3B%20%7D)%22%3E

@foreach (T item in source)   //MIISNF VIRTUALIZE HERE
{
    var rowClass = new CssBuilder(RowClass).AddClass(RowClassFunc?.Invoke(item, rowIndex)).AddClass(customClass, ! string.IsNullOrEmpty("mud-table-row-group-indented-1")).Build();
    var rowStyle = new StyleBuilder().AddStyle(RowStyle).AddStyle(RowStyleFunc?.Invoke(item, rowIndex)).Build();
    <MudTr Class="@rowClass" Style="@rowStyle" Item="item" @key="item" IsCheckable="MultiSelection" IsEditable="IsEditable" IsExpandable="isExpandable"
            IsCheckedChanged="((value) => { var x = item; OnRowCheckboxChanged(value, x); })">
...

Im trying to fix this with the following code snippet

`internal RenderFragment RenderRows(IEnumerable<T> source, string customClass = null, bool isExpandable = false)
    {
        var rowIndex = 0;
        return
        @<text>
            <MudVirtualize IsEnabled="true" Items="@source?.ToList()" Context="item2">
               @{ var rowClass = new CssBuilder(RowClass).AddClass(RowClassFunc?.Invoke(item2, rowIndex)).AddClass(customClass, ! string.IsNullOrEmpty("mud-table-row-group-indented-1")).Build(); }
               @{ var rowStyle = new StyleBuilder().AddStyle(RowStyle).AddStyle(RowStyleFunc?.Invoke(item2, rowIndex)).Build(); }
                <MudTr Class="@rowClass" Style="@rowStyle" Item="item2" @key="item2" IsCheckable="MultiSelection" IsEditable="RowEditingTemplate != null" IsExpandable="isExpandable"
                        IsCheckedChanged="((value) => { var x = item2; OnRowCheckboxChanged(value, x); })">

`

However, Im getting the error as follows, Can someone help me on why this error came.

Severity Code Description Project File Line Suppression State Error CS0103 The name 'item2' does not exist in the current context MudBlazor C:\Users\DELL\Documents\MyGithub\MudBlazor\src\MudBlazor\Components\Table\MudTable.razor 150 Active

Gopichandar pushed a commit to Gopichandar/MudBlazor that referenced this issue Feb 25, 2022
henon pushed a commit that referenced this issue Mar 9, 2022
* MudTable: Fix to include Virtualiation in a grouped rows (#4008)

* Fix to update docs to have example on "BasicGrouping" instead of "TableMultiGrouping"

Co-authored-by: Gopichandar <idartsindia9099@outlook.com>
jammerware pushed a commit to jammerware/MudBlazor that referenced this issue Sep 20, 2022
…azor#4045)

* MudTable: Fix to include Virtualiation in a grouped rows (MudBlazor#4008)

* Fix to update docs to have example on "BasicGrouping" instead of "TableMultiGrouping"

Co-authored-by: Gopichandar <idartsindia9099@outlook.com>
jammerware pushed a commit to jammerware/MudBlazor that referenced this issue Sep 20, 2022
…azor#4045)

* MudTable: Fix to include Virtualiation in a grouped rows (MudBlazor#4008)

* Fix to update docs to have example on "BasicGrouping" instead of "TableMultiGrouping"

Co-authored-by: Gopichandar <idartsindia9099@outlook.com>
jammerware pushed a commit to jammerware/MudBlazor that referenced this issue Sep 20, 2022
…azor#4045)

* MudTable: Fix to include Virtualiation in a grouped rows (MudBlazor#4008)

* Fix to update docs to have example on "BasicGrouping" instead of "TableMultiGrouping"

Co-authored-by: Gopichandar <idartsindia9099@outlook.com>
jammerware pushed a commit to jammerware/MudBlazor that referenced this issue Sep 20, 2022
…azor#4045)

* MudTable: Fix to include Virtualiation in a grouped rows (MudBlazor#4008)

* Fix to update docs to have example on "BasicGrouping" instead of "TableMultiGrouping"

Co-authored-by: Gopichandar <idartsindia9099@outlook.com>
3dots pushed a commit to 3dots/MudBlazor that referenced this issue Mar 23, 2023
…azor#4045)

* MudTable: Fix to include Virtualiation in a grouped rows (MudBlazor#4008)

* Fix to update docs to have example on "BasicGrouping" instead of "TableMultiGrouping"

Co-authored-by: Gopichandar <idartsindia9099@outlook.com>
ferraridavide pushed a commit to ferraridavide/MudBlazor that referenced this issue May 30, 2023
…azor#4045)

* MudTable: Fix to include Virtualiation in a grouped rows (MudBlazor#4008)

* Fix to update docs to have example on "BasicGrouping" instead of "TableMultiGrouping"

Co-authored-by: Gopichandar <idartsindia9099@outlook.com>
ilovepilav pushed a commit to ilovepilav/MudBlazor that referenced this issue Nov 25, 2023
…azor#4045)

* MudTable: Fix to include Virtualiation in a grouped rows (MudBlazor#4008)

* Fix to update docs to have example on "BasicGrouping" instead of "TableMultiGrouping"

Co-authored-by: Gopichandar <idartsindia9099@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant