If in a grid columns are bound to integer values which shall be treated as enum values it can be done with the FieldType parameter.
Unfortunately the new FilterMenuType.CheckBoxList does not work as expected then.
With
<GridColumn Field="@(nameof(MyModel.MyPropertyId))"
FieldType="@(typeof(MyPropertyEnum))"
Title="MyProperty"
FilterMenuType="@FilterMenuType.CheckBoxList">
the filter shows Integers instead of Enum-Strings.
(With FilterMenuType.Menu the filter correctly treats the values as enums)
Regards,
René
If a new item for a grid is created and the CreateHandler is cancelled due to some validation error, the new loading indicator does not disappear.
protected async void CreateHandler(GridCommandEventArgs args)
{
var myItem = (MyModel) args.Item;
if (!IsValid(myItem))
{
args.IsCancelled = true;
return;
}
...
}
Regards,
René
This isn't a bug per say, but with the latest Telerik Blazor update, the GridCommandEventArgs Field and Value properties are now deprecated. When updating a specific cell in a grid using InCell edit mode, how am I able to know which specific field and value are updated when the OnUpdate event gets called? Before the latest update, I had the following code:
protected override void OnGridRowUpdate(GridCommandEventArgs args)
{
validationMessage = ValidateField(args.Field, args.Value);
}
I realize I have the updated values using args.Item, but I don't want to have to validate the entire row every time I update a cell. Is there still a way to know what cell I updated, or is that information no more?
Thank you,
Steve
The grid should support INotifyPropertyChanged for the objects in the grid, i.e. if the data object implements INotifyPropertyChanged and a property value changes, the corresponding cell value in the grid should also change.
I noticed after debugging a problem when editing some rather complex rows in a grid that the grid internally calls Telerik.Blazor.Extensions.ObjectExtensions.Clone(...) to create a deep clone for editing. If the object being cloned implements System.ICloneable then this is ignored and an attempt is made to clone it using reflection - the problem is that ObjectExtensions.Clone(...) fails for a number of cases and observing ICloneable would give a developer the means to implement the correct cloning behaviour.
I'm not asking for ObjectExtensions.Clone(...) to be fixed in any way (after all, no matter what you do there will always be some cases it cannot handle), just to use ICloneable where possible.
As an aside, the failed cases were:
When the Grid/TreeList is in incell edit mode and you finish editing a cell by pressing "Enter", the focus is lost if the next cell to be edited is not editable.
Steps to reproduce:
@using System.ComponentModel.DataAnnotations;
<TelerikGrid Data="@forecasts"
Height="550px"
FilterMode="@GridFilterMode.FilterMenu"
Sortable="true"
Pageable="true"
PageSize="20"
Groupable="true" Resizable="true"
Reorderable="true"
EditMode="@GridEditMode.Incell">
<GridColumns>
<GridColumn Field="Id" Title="Id" Width="100px" Editable="false" Groupable="false" />
<GridColumn Field="Summary" Id="summary" Title="telerik bind-Value">
<Template>
@{
var model = context as WeatherForecast;
<span>@model.Summary</span>
}
</Template>
<EditorTemplate>
@{
var model = context as WeatherForecast;
if (model.CanEdit)
{
<TelerikTextBox @bind-Value="@model.Summary"></TelerikTextBox>
}
else
{
@model.Summary
}
}
</EditorTemplate>
</GridColumn>
</GridColumns>
</TelerikGrid>
@code {
List<WeatherForecast> forecasts { get; set; }
protected override void OnInitialized()
{
forecasts = WeatherForecast.GetForecastList();
}
public class WeatherForecast
{
public int Id { get; set; }
public string Summary { get; set; }
public bool CanEdit { get; set; }
static public List<WeatherForecast> GetForecastList()
{
var rng = new Random();
return Enumerable.Range(1, 150).Select(index => new WeatherForecast
{
Id = index,
Summary = Summaries[rng.Next(Summaries.Length)],
CanEdit = index % 3 != 0
}).ToList();
}
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
}
}
The focus is lost
The focus should not be lost
All
All
x.y.z
x.y.z
If you reorder a column and then lock it, visually it looks locked and the functionality for a locked column is correctly supported.
However, the Locked property of the ColumnStates in Grid State for that column remains "false". Locked = "true" is applied based on the initial column position.
Currently, when navigation is used with virtual columns and locked columns, clicking on a cell, scrolls the cell to the center. The behavior was designed to have consistent interaction with either mouse, or keyboard. However, for mouse interaction such scrolling and changing the cell position according to the mouse cursor is not intuitive.
This bug report will target the scenario with mouse click for cells that are not overlapped by locked columns - they will not be scrolled to the center.
Try to dynamically switch between Scrollable and Virtual modes. You would need to manually refresh the Skip property through the Grid state, or it won't work.
-----------ADMIN EDIT------------
You can use the ValueChanged handler to manually refresh the Skip property as shown below.
public TelerikGrid<ExpandoObject> TelerikGrid { get; set; }
private bool IsPageable = false;
private int Page { get; set; }
public void ChangeHandler(bool value)
{
//Sync the paging with scrolling
if (value)
{
IsPageable = value;
var state = TelerikGrid.GetState();
state.Skip = 0;
state.Page = 3;
_ = TelerikGrid.SetState(state);
}
IsPageable = value;
StateHasChanged();
}
When exporting data from a Grid using ExcelExport, the dates are visible when viewed from Excel, but not when using Open Office or Google Sheets.