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

Add FilterTemplate examples to the DataGrid Docs #5612

Open
Mr-Pearce opened this issue Jul 8, 2024 · 1 comment
Open

Add FilterTemplate examples to the DataGrid Docs #5612

Mr-Pearce opened this issue Jul 8, 2024 · 1 comment
Assignees
Labels
Area: Documentation Something is missing in the documentation.
Projects
Milestone

Comments

@Mr-Pearce
Copy link

Mr-Pearce commented Jul 8, 2024

Currently there is no real example how to use the Filtertemplate.
Beneath https://blazorise.com/docs/extensions/datagrid/templates/

Some examples would be helpfull.
Also i dont know if it is possible.
But binding to the filter from the Filter Template would be nice.

I am currently using the following workaround.

Also is it intended that the Filter on an DataGridDateColumn is an TextBox?
Shouldn't it be a DateEdit or DateTimePicker?

<DataGridDateColumn Field="@nameof(SomeTime.Timestamp)" InputMode="DateInputMode.DateTime" Caption="Zeitpunkt">
                <FilterTemplate >
                    <DateEdit  TValue="DateTime?" Date="@dateFilter" DateChanged="@OnDateFilterChanged" />
                </FilterTemplate>
            </DataGridDateColumn>

public void OnDateFilterChanged(DateTime? date)
    {
        dateFilter = date;
        var columns = dataGrid.GetColumns().FirstOrDefault(x => x.Field == nameof(SomeTime.Timestamp));

        columns.Filter.SearchValue = date;
        dataGrid.FilterData();
        dataGrid.Reload();
    }

but something like would be nice.

<DataGridDateColumn Field="@nameof(SomeTime.Timestamp)" InputMode="DateInputMode.DateTime" Caption="Zeitpunkt">
                <FilterTemplate >
                    <DateEdit  TValue="DateTime?" bind-Date="@context" />
                </FilterTemplate>
            </DataGridDateColumn>

@Mr-Pearce Mr-Pearce added the Type: Feature ⚙ Request or idea for a new feature. label Jul 8, 2024
@David-Moreira
Copy link
Contributor

David-Moreira commented Jul 8, 2024

Hello @Mr-Pearce
We have a dedicated page for filtering :
https://blazorise.com/docs/extensions/datagrid/features/filtering

This is where we had the FilterTemplate example, but granted nowadays there isn't a concrete example,
It seems like we replaced the template example we had on the select column with an actual DataGridSelectColumn.

I think it's worth adding it. But it's usage is like every other template nonethless. (Edit: Altough it might be a bit more involved since you have to explicitly trigger the filtering, so you're right there should be an example.)

image

As for the DateColumn filter, that's coming in v1.6 where we improved the filtering to render more contextual components. (#5585)
You can try it out and give us some feedback prior to the release, if you'd like by using our dev version in myget. https://www.myget.org/gallery/blazorise

@stsrki stsrki added this to 🔙 Backlog in Support via automation Jul 9, 2024
@stsrki stsrki added this to the 1.5 support milestone Jul 9, 2024
@stsrki stsrki added Area: Documentation Something is missing in the documentation. and removed Type: Feature ⚙ Request or idea for a new feature. labels Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Documentation Something is missing in the documentation.
Projects
Support
  
🔙 Backlog
Development

No branches or pull requests

3 participants