Duplicated
Last Updated: 13 Sep 2022 08:13 by ADMIN

Description

When the state is loaded and there is a value in the search box, the X (clear button) is missing. 

Reproduction (if bug)

  1. Create a Grid, set a SearchBox in the toolbar.
  2. Set value in the SearchBox.
  3. Save state.
  4. Refresh the page and apply the state.
  5. The value is present in the searchbox but the X icon is missing.

Expected (if bug)

The X icon should be visible.

Browser (if bug)
All

Project type (if bug)
All

Last working version of Telerik UI for Blazor (if regression)
3.5.0

Duplicated
Last Updated: 15 Sep 2023 10:52 by ADMIN
Created by: Adrian
Comments: 2
Category: Grid
Type: Bug Report
0
 

**Description**:
I've encountered an issue with the Telerik Grid component in Blazor where caching the grid state, specifically the filtering state, leads to a casting exception upon reloading the page.

**Steps to Reproduce**:
1. Set up a Telerik Grid with a nullable enum column (e.g., `LeadStatuses? Status`).
2. Apply a filter to the `Status` column.
3. Save the grid state (including the filter state) to cache.
4. Refresh the browser.
5. Load the grid state from cache and apply it to the grid.

**Expected Behavior**:
The grid should load with the previously applied filter without any issues.

**Actual Behavior**:
A casting exception occurs, specifically: "Specified cast is not valid."

**Additional Information**:
- The issue seems to be related to filtering and saving state to the grid. When the column is removed, the error doesn't occur.
- Clearing the filter from the cached state for gid will work.
- The exact error message is: 
```
Unhandled exception rendering component: Specified cast is not valid.
 
Duplicated
Last Updated: 06 Nov 2023 13:46 by ADMIN
Created by: Michal
Comments: 1
Category: Grid
Type: Bug Report
0

Hello,

 when using grid with multiple-selection mode and row template, ONLY single row selection works. Not able to select multiple rows. Grid somehow internally "reverts"(lose) selection to single row.

Here is full detail, with video and sample "what acts weird". Start with the post " Michal - Posted on: 19 Oct 2023 08:38":

https://feedback.telerik.com/blazor/1463819-grid-row-template-with-selection-unsure-how-to-bind-to-selected-item

 

Simplified reproducible sample from Nadezhda Tacheva(thanks), has that issue also - try to select multiple rows:

REPL sample

Video with the problem AND expected result(video is based on sample posted at same feedback above "Posted on: 19 Oct 2023 08:38":

https://feedback.telerik.com/attachment/download/1120622

 

Fully working example(recorded video) in VS - GridCheckBoxColumn in sample "IS HACK!", not required at all(just hint, which can be removed):

@using System.Collections.Generic;
@using System.Dynamic;
    <span>Selection bind not working as expected:</span>
    <TelerikGrid TItem="ExpandoObject"
    @bind-SelectedItems="@gSelectedItems"
                 OnRowClick="@OnGridRowClicked"
                 SelectionMode="GridSelectionMode.Multiple"
                 OnRead=@gHLReadItems
                 RowHeight="60">
        <RowTemplate Context="ctx">
            <td>
                @{
                    var it = (ctx as IDictionary<string, object>);
                    @(it["Name"].ToString())
                }
            </td>
        </RowTemplate>
        <GridColumns>
            <GridCheckboxColumn CheckBoxOnlySelection="true" Visible="false" @key="@("sIDX1")" SelectAll="false" />
            <GridColumn Field="Name" FieldType=@typeof(string) Title="Name" />
        </GridColumns>
    </TelerikGrid>
<span>WORKs OK:</span>
    <TelerikGrid TItem="ExpandoObject"
    @bind-SelectedItems="@gSelectedItems"
                 OnRowClick="@OnGridRowClicked"
                 SelectionMode="GridSelectionMode.Multiple"
                 OnRead=@gHLReadItems
                 RowHeight="60">
        <GridColumns>
            <GridCheckboxColumn CheckBoxOnlySelection="true" Visible="false" @key="@("sIDX2")" SelectAll="false" />
            <GridColumn Field="Name" FieldType=@typeof(string) Title="Name" />
        </GridColumns>
    </TelerikGrid>
        
@code
{
    private List<ExpandoObject> RowData;
    IEnumerable<ExpandoObject> gSelectedItems { get; set; } = Enumerable.Empty<ExpandoObject>();
    protected override void OnInitialized()
    {
        
        RowData = new List<ExpandoObject>();
        dynamic obj0 = new ExpandoObject();
        obj0.Name = "Tester";
        RowData.Add(obj0);
        dynamic obj1 = new ExpandoObject();
        obj1.Name = "Testovicz";
        RowData.Add(obj1);
        dynamic obj2 = new ExpandoObject();
        obj2.Name = "Selectant";
        RowData.Add(obj2);
    }
    protected async Task gHLReadItems(GridReadEventArgs args)
    {
        //RowData are readen from DYNAMIC source, cannot add any NEW property to it
        args.Data = RowData;
        args.Total = 3;
    }
    protected void OnGridRowClicked(GridRowClickEventArgs args)
    {
        var it = args.Item as ExpandoObject;
        if (gSelectedItems.Any(x => x == it))
        {
            gSelectedItems = gSelectedItems.Where(x => x != it);
        }
        else
        {
            gSelectedItems = gSelectedItems.Union(RowData.Where(x => x == it));
        }
    }
}

thanks

1 2