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.26k stars 526 forks source link

DataGridColumn Filter Template #633

Closed vmakharashvili closed 4 years ago

vmakharashvili commented 4 years ago

In DataGrid there is a very useful filter textboxes. I use them really well as server-side filtering. However, there is an issue: this filter is only string type and when we need int, Date, multiple-choice or other type filters, this filter becomes useless.

I think there will be good idea to have a filter-template inside DataGridColumn. This will give us ability to have our own custom filter which will be super-useful.

For example:

<DataGrid TItem="Customer" Data="@_customers" PageSize="CustomerService.PageState[Page.Customers].PageSize" Filterable="true"
          RowDoubleClicked="((e) => OnCustomerRowClick((e.Item as Customer)))" Narrow="true" Hoverable="true"
          ReadData="(e => ReadData(e))">
    <DataGridColumn TItem="Customer" Field="@nameof(Customer.Id)" Caption="Id" Sortable="true" Filterable="true" Filter="@Filter("Id")">
        <DataGridColumnFilterTemplate>
            ... some code
        </DataGridColumnFilterTemplate>
    </DataGridColumn>
    </DataGridNumericColumn>
</DataGrid>
stsrki commented 4 years ago

I tried that already #331

The problem is in how Blazor works when building the render-tree and I was unable to do anything. To make this work I will either have to rebuild DataGrid internals or do it something like this #394

I will have to decide after I have more time to investigate.