Megabit / Blazorise

Blazorise is a component library built on top of Blazor with support for CSS frameworks like Bootstrap, Tailwind, Bulma, AntDesign, and Material.
https://blazorise.com/
Other
3.32k stars 535 forks source link

[Bug]: headergroupcaption and displayable not working properly together #5614

Closed blenke closed 4 months ago

blenke commented 4 months ago

Blazorise Version

1.5.3

What Blazorise provider are you running on?

Bootstrap5

Link to minimal reproduction or a simple code snippet

    <Check TValue="bool" @bind-Checked=@showfn>show first name</Check>

    <DataGrid TItem="Student" Data="@so" Striped="true" Filterable="true" FixedHeader=true
              SortMode="DataGridSortMode.Single" Virtualize
              Resizable Responsive Narrow ShowHeaderGroupCaptions>

        <DataGridColumn Field="@nameof(Student.Number)" Caption="Number" HeaderGroupCaption="Personal" />
        <DataGridColumn Field="@nameof(Student.FirstName)" Caption="First name" HeaderGroupCaption="Personal" Displayable="@showfn" />

    </DataGrid>
@code{
bool showfn=true;
}

Steps to reproduce

add HeaderGroupCaption to a DataGrid and add the Displayable property to one or more columns. Now change the displayable property.

What is expected?

if the Displayable value becomes false both the header and the data in the column should be hidden

What is actually happening?

only the header is changed , the data remains and the header and data of the following columns will be incorrect. Without the HeaderGroupCaption this works as expected.

What browsers do you see the problem on?

Chrome, Microsoft Edge

Any additional comments?

if the ShowHeaderGroupCaptions is not added then the Displayable on/off works but obviously there won't be any HeaderGroupCaptions visible.

blenke commented 4 months ago

I noticed that this problem also occurs when using the build in column chooser or when using the new SetDisplaying option from version 1.6. Column is removed from the header but not the data itself.

David-Moreira commented 4 months ago

I noticed that this problem also occurs when using the build in column chooser or when using the new SetDisplaying option from version 1.6. Column is removed from the header but not the data itself.

If I remember correctly, Displayable is an init only property. For changing the Display on the fly, you need to use SetDisplaying.

Edit: APologies, I missunderstood, you have already used those options, we need to take a look.

blenke commented 4 months ago

some additional info, if the ShowHeaderGroupCaptions is initially set to false and then after the datagrid has completed rendering set to true, then it works as expected. Unfortunately this can only be done with a manual user action so not a good work around. Note that this issue also occurs with the column chooser.

David-Moreira commented 4 months ago

Well. Having some very weird behaviors where in fact stuff does not get correctly refreshed. Even if we switch pages which warrants a refresh, stuff shows half "refreshed"? Not sure what's going on, we need more investigation, if you have anything else that can help us let us know. image