Telerik Forums
UI for Blazor Forum
1 answer
14 views

Hello,

 

I have a grid filterable with one column with FilterMenuType.CheckBoxList. 

I initialize a defaut filter with OnStateInit which work fine. But when I change the filter by selecting "Select all", nothing is return. It only work when I clear the filter first.

I reproduce the issue here : https://blazorrepl.telerik.com/GokJaiFR56kNGYBW07

Am I doing something wrong with the default filter or is it a bug? I can't find anything related.

 

Thanks in advance

Nansi
Telerik team
 answered on 13 May 2024
1 answer
11 views

Hello,

i do have a Grid column in the Grid and i want to enter a date range filter in the filter row.
how can i implement this?

best regards

Volkhard

Hristian Stefanov
Telerik team
 answered on 06 May 2024
1 answer
8 views

Hello,
i want to change the color of a header cell text  when the user enters some filter criteria for this column in the filter row.

can you help me?  How can i implement this?

best regards

Volkhard

Hristian Stefanov
Telerik team
 answered on 06 May 2024
1 answer
22 views
My scenario is that I have a grid of User. 
a User has Roles. 

I have a column that I have used the <Template> to display a chip of each Role a User has. 


The FilterTemplate does not have a solution to filter this collection out of the box. 
Have you solved this or similar? Please share any helpful feedback here as I am blocked on this task. 

I would prefer not to filter on a concatenated string of the users roles, as if I click the filter checkbox 'Admin' it would show results for any role that had Admin in it's name. 

If you used the OnRead event, when did you apply your filter and how?  

Thanks so much for your feedback on how you've solved this for your use case. 
 
Nadezhda Tacheva
Telerik team
 answered on 01 Mar 2024
1 answer
30 views

When using a detail template on a grid control, the user must click twice to expand the detail section after filtering.  

Executable: https://blazorrepl.telerik.com/QyummElT43XLHu3R42

Steps to reproduce:
1) Load Page

2) Make a selection from the category drop down filter

3) Attempt to expand the detail section of any record by clicking on the "+"


@page "/" @using Telerik.DataSource <TelerikGrid TItem="@Person" OnRead="@LoadGrid" SelectionMode="GridSelectionMode.Single" FilterMode="GridFilterMode.FilterRow" FilterRowDebounceDelay="200" Pageable="true" PageSize="15"><DetailTemplate> @{ var selected = context as Person; } <div class="row">

<div class="col-2">

<h1>@selected.First</h1>

</div>

<div class="col-2">

<h1>@selected.Last</h1>

</div>

</div>

</DetailTemplate>

<GridColumns>

<GridColumn Field="@nameof(Person.First)" Title="First" Filterable="false"></GridColumn>

<GridColumn Field="@nameof(Person.Last)" Title="Last" Filterable="false"></GridColumn>

<GridColumn Field="@nameof(Person.Category)" Title="Category">

<FilterCellTemplate> @{ CategoryFilter = context; } <TelerikDropDownList Data="Categories" @bind-Value="SelectedCategory" OnChange="SetupCategoryFilter">

</TelerikDropDownList>

</FilterCellTemplate>

</GridColumn>

</GridColumns>

</TelerikGrid> @code { private FilterCellTemplateContext CategoryFilter { get; set; } = new(); private List<int> Categories = [0, 1, 2, 3, 4]; private int SelectedCategory { get; set; } private async Task SetupCategoryFilter() { var filter = CategoryFilter.FilterDescriptor.FilterDescriptors[0] as FilterDescriptor; if (filter is null) { return; } filter.Value = SelectedCategory; filter.Operator = FilterOperator.IsEqualTo; await CategoryFilter.FilterAsync(); } protected void LoadGrid(GridReadEventArgs args) { List<Person> list = [ new Person {First = "John", Last = "Doe", Category = 1}, new Person {First = "Jane", Last = "Doe", Category = 2}, new Person {First = "John", Last = "Smith", Category = 3}, new Person {First = "Jane", Last = "Smith", Category = 4} ]; args.Data = list; args.Total = list.Count; }

public class Person
{
    public string First { get; set; }

    public string Last { get; set; }

    public int Category { get; set; }
}

}


Tsvetomir
Telerik team
 answered on 22 Feb 2024
0 answers
22 views

Hello Telerik Team,

When i tried to bound Grid to a ExpandoObject or DataTable  I can't use filter properties .It throws unhandling Exception error. How to sort out this issue.

1 answer
49 views

I am using a Telerik DataGrid in Blazor to display entity data.  In this grid, one column's  Field represents a one-many data relationship.  The Field type is an int, however in this column we use both a <Template> and a <EditorTemplate> to display string values associated with the backing Ints, which serves as an ID for this data.  This string data is not stored in this application, but rather retrieved via a webAPI from another application that manages it.

Is it possible to filter the column based on how the data is rendered in the display Template, which is a string?  At present, any filtering at all Below is the code for the data grid.  The column on which we would like to filter based on the string rendered in the template is bolded:

 <TelerikGrid Data="@BranchList"
             FilterMode="@GridFilterMode.FilterMenu"
             EditMode="GridEditMode.Inline"
             OnUpdate="@UpdateHandler"
             OnCreate="@CreateHandler"
             Resizable="true"
             Sortable="true"
             SortMode="SortMode.Single">
    <GridToolBar>
            <GridCommandButton Command="Add" Icon="add">Add New OB Branch</GridCommandButton>
    </GridToolBar>

    <GridColumns>
             <GridCommandColumn Width="100px">
                 <GridCommandButton Command="Edit" Icon="edit">Edit</GridCommandButton>
                 <GridCommandButton Command="Save" Icon="save" ShowInEdit="true">Save</GridCommandButton>
                 <GridCommandButton Command="Cancel" Icon="cancel" ShowInEdit="true">Cancel</GridCommandButton>
             </GridCommandColumn>
        
        <GridColumn Field="Id" FieldType="@typeof(int)" Editable="false" Visible="false" />
        <GridColumn Field="Name" FieldType="@typeof(string)" Editable="true" Title="Branch Name" Width="200px"/>
        <GridColumn Field="GroupId" FieldType="@typeof(int)" Editable="true" Visible="true" Title="Group" Sortable="true" Filterable="true" Context="context" Width="100px">
            <Template Context="ctx">
                @{
                   var b = ctx as OptimalBlueBranch;
                    <span>@(Groups.Where(g=>g.Id == b.GroupId).Select(g=>g.Name).FirstOrDefault())</span>
                }
            </Template>
            <EditorTemplate Context="ctx">
                @{
                    var b = ctx as OptimalBlueBranch;
                    <TelerikComboBox Data="@Groups" TextField="Name" ValueField="Id" @bind-Value="@b.GroupId"
                                     Placeholder="Add a group" ClearButton="true" Filterable="true">
                    </TelerikComboBox>
                }
            </EditorTemplate>
        </GridColumn>
        <GridColumn Field="Active" Title="Active" FieldType="@typeof(bool)" Editable="true" Width="100px">
            <Template Context="ctx">
                @{
                    var b = ctx as OptimalBlueBranch;
                    <input type="checkbox" checked="@b.Active" disabled />
                }
            </Template>

        </GridColumn>
        <GridColumn Field="Mappings" Title="Oasys Branch Mappings" Filterable="true" Width="250px">
            <Template Context="ctx">
                @{
                    var b = (ctx as OptimalBlueBranch).Mappings;

                    var mapped = b.Any();
                    var styleClass = SetBranchBlockStyle(b);

                    <span class="@styleClass fill-cell">

                        @if (b != null && b.Count > 0)
                        {
                            foreach (var mapping in b)
                            {

                        <span>@GetOasysBranchName(mapping),&nbsp;</span>
                            }
                        }
                        else
                        {
                        <span>No Oasys branches mapped</span>

                        }
                    </span>

                }
            </Template>

            <EditorTemplate Context="ctx">
                @{
                    var b = ctx as OptimalBlueBranch;


                    <TelerikMultiSelect Data="@OasysBranches" @bind-Value="@b.Mappings"
                                        TextField="Name" ValueField="Code" Placeholder="Add relevant branches" AutoClose="false"> </TelerikMultiSelect>
                }


            </EditorTemplate>
        </GridColumn>
    </GridColumns>

</TelerikGrid>
Hristian Stefanov
Telerik team
 answered on 21 Nov 2023
0 answers
48 views

I have a Blazor Server app using TelerikGrid.  The grid has lots of columns and I have FilterMode set to FilterRow and the default filtering works great.  However, since the grid is also set to ScrollMode Virtual, there is no immediate indication of how well the filter is defined.  To fix this I want to display the number of records that are actually "filtered in" in comparison to the total number of records possible so that the user can tell if they've (for example) selected nearly all the records.  

I've looked everywhere and I cannot find a way to ask the grid how many records are currently filtered in.

It seems like I could take the FilterDescriptors, convert them to SQL for a where clause, and run the query every time they change the filter, but that seems like such a waste to essentially run the filter twice every time it reloads.  Even though my dataset is currently small enough that I cache the whole thing on the server, I'm still doing twice the work to get to a number the grid must know.

Here is a snippet from my Razor file:

@code { privateint _filteredCount = 0; // How to set this? } <TelerikGrid Data="@_applications" Pageable="false" Sortable="true" Resizable="true" FilterMode="@GridFilterMode.FilterRow" Width="100%" ScrollMode="@GridScrollMode.Virtual" OnStateInit="(GridStateEventArgs<ApplicationListDTO> args) => StateInitHandler(args)" OnStateChanged="(GridStateEventArgs<ApplicationListDTO> args) => StateChangedHandler(args)" Height="540px" RowHeight="60"> <GridColumns> Column definitions left outfor brevity </GridColumns>

</TelerikGrid> <div class="applicationCount">@(_applications.Count()) applications found, @_filteredCount listed</div>

Suggestions?

Scott
Top achievements
Rank 1
 updated question on 22 Sep 2023
1 answer
55 views
Perhaps a silly question but wanted to do a sanity check anyway. I know there are several ways to build custom filter descriptors and custom filter menus with the FilterMenuTemplate. I just want to use the existing default FilterDescriptors but more instances of them without re-creating the entire FilterMenu. For example, instead of having the default two FilterDescriptors with the Logic operator separating them, have three or four, all separated with a Logical Operator.
Dimo
Telerik team
 answered on 10 Jul 2023
0 answers
66 views

I only want my users to be able to add one level of groups to their filters.

 

For example:

Color = blue

AND

    (

        height > 3

        OR

        height < 1

    )

OR

       foo = bar

 

I don't want them to add sub-groups to groups (adding an AND group inside of the height block in the above). Is there a way to prevent that from happening in the control?

Bill
Top achievements
Rank 1
Iron
Iron
 asked on 02 Jun 2023
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?