IvanJosipovic / BlazorTable

Blazor Table Component with Sorting, Paging and Filtering
https://BlazorTable.netlify.app
MIT License
539 stars 109 forks source link

Pre Setup Columns visibility..!! #237

Open irushabh opened 3 years ago

irushabh commented 3 years ago

Hello Ivan,

Really great Component for DataGrid in Blazor. I have some question regarding implementing GRID.

Question 1: Can you please guide me how to set grid columns visibility from oninitialized event?

image

NilsPur commented 3 years ago

Should be possible this way (example):

<Table @ref="table" ...> 
...
</Table>
    private ITable<T> table;

    protected override async Task OnInitializedAsync()
    {
        foreach (IColumn<T> column in table.Columns)
        {
            if (column.Title == "xyz") // condition
            {
                column.Visible = false; // column visibility
            }
        }
    }