BlazorTable icon indicating copy to clipboard operation
BlazorTable copied to clipboard

How do you hide column ?

Open thudugala opened this issue 5 years ago • 5 comments

Blazor beginner, How do you hide a column ?

thudugala avatar Apr 08 '20 06:04 thudugala

Columns can't be hidden. I will look to add this in a future release.

IvanJosipovic avatar Apr 18 '20 07:04 IvanJosipovic

Add Class="d-none" to the column if you are using Bootstrap - that seems to work.

ghost avatar May 06 '20 23:05 ghost

I want to show and hide dynamically

thudugala avatar Jun 09 '20 05:06 thudugala

I tested setting a checkbox on a page to control visibility, then setting the Class based on this using a variable, e.g.

    string columnCSS => columnVisible ? null : "d-none";
    bool columnVisible = true;

and in the table

<Column TableItem="PersonData" Title="Full Name" Field="@(x => x.full_name)" Sortable="true" Filterable="true" Width="20%" Class="@columnCSS" />

However this was rather flaky - the checkbox caused it to appear and disappear in the reverse of the expected value! Not sure what's going on.

conficient avatar Jul 30 '20 17:07 conficient

I also have this use case. Based on the role of the user I need to show only a select set of columns.

Currently, I have whole <Column></Column> sections selectively wrapped inside @if statements - this works well to initially render the table correctly. Toggling, however, causes Columns to be added repeatedly. I'll opt to redraw the whole table instead.

Using bootstrap/css/html to simply toggle visibility of columns is not enough, since both actions and data would still be exposed.

Cheers, Gregor

gregorvilkner avatar Sep 10 '20 15:09 gregorvilkner