Unplanned
Last Updated: 04 Apr 2023 12:09 by Adam
Created by: Adam
Comments: 0
Category: Grid
Type: Bug Report
6
The Grid throws ObjectDisposedExceptions
Declined
Last Updated: 03 Apr 2023 11:07 by ADMIN
Created by: Clark
Comments: 1
Category: Grid
Type: Bug Report
1

Problem

It seems the Grid and GridSearchBox assume the search string by taking the value of GridState.SearchFilter.FilterDescriptors[0].Value and this is causing a few issues:

  1. If the first filter is a CompositeFilterDescriptor, it causes an exception.
  2. If there is no filter, the search box gets cleared.
  3. If the first filter has a different value than what was typed (because filters were added/changed programmatically), the search box value will be changed.

Background

I am expanding grid search to include non-string columns, and I want this to apply by default across our entire application without having to update every grid individually or developers having to remember to opt in.

To search other type columns, I’ve largely taken the logic from Search Grid in numeric and date fields - Telerik UI for Blazor and it works well. However, that solution utilizes a custom search box component that I would have to add to each grid.

Instead, I have placed this filter creation logic in the OnStateChanged handler as exemplified in How to Search Grid Items with a StartsWith Filter Operator - Telerik UI for Blazor, as we already have a handler for this event that all grids utilize.

This has worked wonderfully except for the issues I’ve mentioned.

Issue #1 – CompositeFilterDescriptor causes exception

If the first filter is a CompositeFilterDescriptor, it causes an exception. Specifically:

Unable to cast object of type 'Telerik.DataSource.CompositeFilterDescriptor' to type 'Telerik.DataSource.FilterDescriptor'.
   at Telerik.Blazor.Components.Common.TableGridBase`2.LoadSearchFilter(IFilterDescriptor descriptor)
   at Telerik.Blazor.Components.TelerikGrid`1.SetStateInternal(GridState`1 state)
   at Telerik.Blazor.Components.TelerikGrid`1.<SetStateAsync>d__311.MoveNext()
   at Web.Pages.Grid.<OnStateChangedHandler>d__18.MoveNext() in C:\src\Web\Pages\Grid.razor:line 196

If there is another filter in the collection that is not a CompositeFilterDescriptor, I can work around this problem by moving it to the front of the list.

// Make sure first filter is not composite.
var nonCompositeFilter = newSearchFilter.FilterDescriptors.OfType<FilterDescriptor>().FirstOrDefault();
if (nonCompositeFilter is not null && newSearchFilter.FilterDescriptors[0] is CompositeFilterDescriptor)
{
    newSearchFilter.FilterDescriptors.Remove(nonCompositeFilter);
    newSearchFilter.FilterDescriptors.Insert(0, nonCompositeFilter);
}

However, if all filters are composite, the exception is unavoidable.

Issue #2 – Search box gets cleared

If the GridState.SearchFilter.FilterDescriptors collection is empty, the search box gets cleared. This is a problem when a user needs to type more characters for a filter to be created.

For example, let’s say you are only searching DateTime columns and using the logic from Search Grid in numeric and date fields - Telerik UI for Blazor. As you type, it checks to see if the input is an integer between 1000 and 2100. Until you type the fourth digit, it will not meet that condition thus will not add a filter. So if you begin by typing “2”, it searches and a filter will not be added yet. However, because there are no filters, it will clear the search box. You won’t be able to type out a full year value of “2023” unless you type fast enough to outpace the debounce delay.

Issue #3 – Search box gets changed

Using the same example as above but with an Enum column instead of a DateTime, begin typing text. If the text matches an enum name, a filter is added for the enum item’s underlying value. For example:

  1. Type “e”.
  2. The first enum item’s name matches “e”, so a filter is added for (int)item IsEqualTo 0.
  3. The search box text is replaced with “0”.

Possible solutions?

  1. Is there some sort of “dummy” filter descriptor I could add to the beginning of the FilterDescriptors collection? Like, it would contain the search string as the Value but it would always evaluate to true and never affect which records match?
  2. I give in and create a custom search box component to hold the search string value separate from GridState, which would require me to update every current and future grid after all.
  3. Telerik could add a SearchString property to the GridState separate from the SearchFilter so that any filter changes would not affect the search string. Or something.

Sample project attached.

Duplicated
Last Updated: 30 Mar 2023 08:15 by ADMIN
Created by: Daniel
Comments: 3
Category: Grid
Type: Feature Request
3

I am trying to get the currently filtered data out of the grid as per this KB article and I want to include the searchbox filters. I do not, however, want to use OnRead but I want to get the grid state on a click of a button and get the filters plus the searchbox filters from it instead.

---

ADMIN EDIT

Here is a sample of getting those filters through the OnRead event without using remote operations - all the data is in the view model (the SourceData field) so this does not change the way operations happen compared to not using OnRead.

@using Telerik.DataSource
@using Telerik.DataSource.Extensions

@( new MarkupString(output) )

<br />
<TelerikButton OnClick="@GetFilters">Get Filters</TelerikButton>


<TelerikGrid Data=@GridData TotalCount=@Total OnRead=@ReadItems
             FilterMode=@GridFilterMode.FilterRow Sortable=true Pageable=true EditMode="@GridEditMode.Inline">
    <GridToolBar>
        <GridSearchBox />
    </GridToolBar>
    <GridColumns>
        <GridColumn Field=@nameof(Employee.ID) />
        <GridColumn Field=@nameof(Employee.Name) Title="Name" />
        <GridColumn Field=@nameof(Employee.HireDate) Title="Hire Date" />
        <GridCommandColumn>
            <GridCommandButton Command="Save" Icon="save" ShowInEdit="true">Update</GridCommandButton>
            <GridCommandButton Command="Edit" Icon="edit">Edit</GridCommandButton>
            <GridCommandButton Command="Delete" Icon="delete">Delete</GridCommandButton>
            <GridCommandButton Command="Cancel" Icon="cancel" ShowInEdit="true">Cancel</GridCommandButton>
        </GridCommandColumn>
    </GridColumns>
</TelerikGrid>

@code {
    TelerikGrid<Employee> GridRef { get; set; }
    string output { get; set; }
    public DataSourceRequest CurrentRequest { get; set; }
    void GetFilters()
    {
        output = string.Empty;


        foreach (var item in CurrentRequest.Filters)
        {
            if (item is FilterDescriptor) // filter row
            {
                FilterDescriptor currFilter = item as FilterDescriptor;
                output += $"field: {currFilter.Member}, operator {currFilter.Operator}, value: {currFilter.Value}<br />";
            }

            if (item is CompositeFilterDescriptor) // filter menu
            {
                CompositeFilterDescriptor currFilter = item as CompositeFilterDescriptor;
                output += $"START nested filter: logical operator: {currFilter.LogicalOperator}, details:<br />";
                // there will actually be 1 or 2 only, this showcases the concept and the types
                foreach (FilterDescriptor nestedFilter in currFilter.FilterDescriptors)
                {

                    output += $"field: {nestedFilter.Member}, operator {nestedFilter.Operator}, value: {nestedFilter.Value}<br />";
                }
                output += "END nested filter<br />";
            }
        }
    }




    public List<Employee> SourceData { get; set; }
    public List<Employee> GridData { get; set; }
    public int Total { get; set; } = 0;

    protected override void OnInitialized()
    {
        SourceData = GenerateData();
    }

    protected async Task ReadItems(GridReadEventArgs args)
    {
        CurrentRequest = args.Request;


        var datasourceResult = SourceData.ToDataSourceResult(args.Request);

        GridData = (datasourceResult.Data as IEnumerable<Employee>).ToList();
        Total = datasourceResult.Total;

        StateHasChanged();
    }

    //This sample implements only reading of the data. To add the rest of the CRUD operations see
    //https://docs.telerik.com/blazor-ui/components/grid/editing/overview

    private List<Employee> GenerateData()
    {
        var result = new List<Employee>();
        var rand = new Random();
        for (int i = 0; i < 100; i++)
        {
            result.Add(new Employee()
            {
                ID = i,
                Name = "Name " + i,
                HireDate = DateTime.Now.Date.AddDays(rand.Next(-20, 20))
            });
        }

        return result;
    }

    public class Employee
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public DateTime HireDate { get; set; }
    }
}

---

Unplanned
Last Updated: 22 Mar 2023 14:33 by Mark
Unplanned
Last Updated: 20 Mar 2023 10:54 by Michael

Imagine a Grid with two editable columns, which are separated by a few non-editable ones. In the standard use case, tabbing from the first editable column should jump over the non-editable columns, and the user should end up in the second editable column.

However, if the Grid uses virtual columns and the second editable column is not rendered, tab-to-edit will stop working.

Unplanned
Last Updated: 15 Mar 2023 11:53 by Jakub
Expose a parameter that allows changing the default behavior of the CheckboxList filters. Currently, all distinct options are included in the CheckBoxList. It would be useful if we can configure this and make the filters cascade like in an excel table.
Completed
Last Updated: 14 Mar 2023 12:09 by ADMIN

Hello,

I seem to have stubled upon a strange bug in TelerikGrid. We have wrapped a TelerikGrid and the Columns are also wrapped to allow special actions.
The bug is present in "raw-telerik-code" as well.

We have an edge case where we have a TelerikGrid and some of its columns should be Locked (Stickied/Frozen) as a default behaviour.
But depending on user interaction we want to change the state. We cannot use a property for each column that we want to be Locked/Unlocked as it should be handled by the GridState.

When the Column is using default behaviour (not Templated), it works as intended. But as soon as you use a <Template> for the Column, the Locked state cannot be changed from the default/supplied value.

TLDR: Programmatically changing the Locked state of a column where the cell is templated will not change the locked state.

I have prepared two REPL examples. One for 3.7.0 as it is what we currently are using, and one for 4.0.1 as to prove that it still exists in the current itteration.

3.7.0
https://blazorrepl.telerik.com/cHEHurlI06olUsJ410


4.0.1
https://blazorrepl.telerik.com/cdYRuBvo07aB6BGY39

 

With best regards

Completed
Last Updated: 08 Mar 2023 10:07 by ADMIN
Release 4.1.0 (15/03/2023)
Created by: Meindert
Comments: 2
Category: Grid
Type: Bug Report
2
Triggering edit mode leads to re-renders in other cells. 
Unplanned
Last Updated: 06 Mar 2023 11:53 by Peter

Currently, the Grid doesn't display its built-in loading animation on initial data (page) load.

The OnRead handler is now completely decoupled with the Data parameter, so the limitation can be removed at least for OnRead scenarios.

Unplanned
Last Updated: 28 Feb 2023 09:21 by Valentin
Created by: Valentin
Comments: 0
Category: Grid
Type: Feature Request
3

We found out during SQL profiling that when bound to an IQueryable (linked to DbContext) with pagination enabled, the Telerik data grid called SQL to count elements twice. This is not a pre-render problem as those deplicated queries are actually executed twice (one pair for each render).

Our simplified code:

<TelerikGrid TItem="Item"
             Data="_data"
             PageSize="10"
             Pageable="true"
             Sortable="true">
    <GridColumns>
        <GridColumn Field="@nameof(Item.Id)" />
        <GridColumn Field="@nameof(Item.Code)" />
    </GridColumns>
</TelerikGrid>

@code {
    [Inject] protected DbContext DbContext { get; set; }

    private IEnumerable<Item> _data;

    protected override void OnInitialized()
    {
        base.OnInitialized();
        _data = DbContext.Items
            .Select(x => new Item()
            {
                Id = x.Id,
                Code = x.Code
            });
    }
}

===

ADMIN EDIT:

There are two possible ways to avoid the double COUNT:

  • Enumerate the collection before binding the Grid. For example, call ToList().
  • Bind the Grid via OnRead event. This gives full control over the data binding process and possible optimizations.
Completed
Last Updated: 24 Feb 2023 20:55 by ADMIN
If I bind a GridColumn to a char, the Export throws an exception that Char cannot be converted to Double. 
Completed
Last Updated: 23 Feb 2023 07:22 by ADMIN
Release 2.30.0
Created by: Tom
Comments: 3
Category: Grid
Type: Feature Request
10

I would like to be able to customize the default format for dates and numbers that the grid has to, for example, use the current UI culture of my app.

*** Thread created by admin on customer behalf ***

Unplanned
Last Updated: 23 Feb 2023 07:16 by Christian

When the user tries to edit a cell in the Grid an exception is thrown. This happens if the Model to which the Grid is bound has an indexer property.

Reproduction: https://blazorrepl.telerik.com/mdEcQxkr15PH4bip51

===

A possible workaround is to map the data to a collection of a different type that has no indexer property: https://blazorrepl.telerik.com/cxaGwcOC383PD8Jr24

 

Unplanned
Last Updated: 14 Feb 2023 10:55 by Tino

When I autofit all columns multiple times in a row, the Grid misbehaves and wraps longer column content in multiple lines. 

<AdminEdit>

As a workaround, set the MinResizableWidth parameter of the Grid columns that wrap their content.

</AdminEdit>

Unplanned
Last Updated: 09 Feb 2023 11:57 by Meindert
Created by: Meindert
Comments: 0
Category: Grid
Type: Bug Report
1

Hello,

Imagine a Grid with in-cell editing and a cell X, which restricts editing via IsCancellable = true in the OnEdit event.

If the user clicks on cell X, then editing will be cancelled and the focus will be on this cell.

If the user tabs from the previous cell, then editing will be cancelled and the focus will be on the previous cell.

This looks like an inconsistency. Can the focus go to cell X when editing is cancelled from a tab?

Unplanned
Last Updated: 27 Jan 2023 11:57 by Miroslav

Page Down and Page Up buttons are not working until the user clicks on the scroll when virtual scrolling is enabled.

To reproduce the issue:

1. Open the following REPL example:

https://blazorrepl.telerik.com/QHYPQVFv55nHGRWV59

2. Focus on the Grid.

3. Try to scroll with the PageDown button.

 

 

Unplanned
Last Updated: 23 Jan 2023 12:14 by Miroslav

Hello,

The filter row noticeably slows down the tabbing speed during Grid in-cell editing in WASM apps.

Completed
Last Updated: 20 Jan 2023 09:07 by ADMIN
Release 4.0.1

As of UI for Blazor 4.0. ExcelExportableColumn is inaccessible due to its protection level and GridExcelExportColumn should be used instead.

I am trying to add the hidden columns to the exported file through the OnBeforeExport event. However, I am unable to create an exportable column instance using the GridExcelExportColumn. I get the following error:

CS1729: GridExcelExportColumn does not contain a constructor that takes 0 arguments.

 

Completed
Last Updated: 14 Jan 2023 09:21 by ADMIN
Release 2.17.0

The GroupFooterTemplate works great for showing aggregate values per group.

Need the same functionality for the entire Grid, ie, sum of all values displayed for a column even if no grouping is applied.

Unplanned
Last Updated: 12 Jan 2023 09:19 by Peter
Created by: Peter
Comments: 0
Category: Grid
Type: Feature Request
1

Hello,

Please consider Grid data binding support for ImmutableArray. Currently, it crashes when the Grid tries to retrieve the total items count at:

Data.AsQueryable().Count();

Immutable*<T> classes are popular in state libraries.

Currently, the possible workarounds are:

  • Execute .ToArray() on the ImmutableArray and bind the Grid to the new array.
  • Bind the Grid to IReadOnlyCollection.