Hi Telerik team,
When I want to bind the Blazor Grid to an ExpandoObject I need to assign the FieldType. I know I have to use non-nullable types.
But I want to use nullable types (for example int?) to have a blank cell within the Grid when there is no value for it. With "typeof(int)" instead of "typeof(int?)" every empty cell shows "0" which I don't want.
Is there any chance to let FieldType accept nullable types?
Best regards,
Rayko
Hi.
Is it possiblle add a contextual menu on a grid row and choose actions for that row?
Thanks.
I am using this sample to implement server-side grouping:
https://github.com/telerik/blazor-ui/tree/master/grid/datasourcerequest-on-server/WasmApp
Now I need Aggregate sum for the price in the GroupFooterTemplate. When I add aggregates, exceptions are thrown if a group footer uses the aggregate value, if not - the grid simply does not look grouped.
---
ADMIN EDIT
The issue stems from the inability of the System.Text.Json to deserialize interfaces - there are a couple of interfaces in the datasource request and data source result related to aggregates. Preliminary review indicates that perhaps some or all of them might be changed to, for example, Dictionary<string, object> from the current IDictionary<string, object>, or perhaps the framework might "learn" to deserialize interfaces.
----
I need to know which cell the user right clicked on so I can adjust my context menu. I need the cell value, the row model and the field of the column.
---
ADMIN EDIT
The following KB article shows a solution you can use immediately: https://docs.telerik.com/blazor-ui/knowledge-base/grid-which-cell-context-menu.
---
The select-all functionality of the Grid is slow in WebAssembly apps, when SelectAllMode="GridSelectAllMode.All".
A possible workaround is to use a CheckBoxColumn HeaderTemplate.
In a filterable Grid, if a column is not bound to a field from the model the Grid uses, it throws with:
Error: System.ArgumentNullException: Value cannot be null. (Parameter 'nullableType')
Reproduction: https://blazorrepl.telerik.com/GyEUlFEs04AUJoJ601.
The issue is reproducible :
===
ADMIN EDIT
===
A possible workaround for the time being is to set the FieldType of the column: https://blazorrepl.telerik.com/wSugvFui10jhcpZy00.
Please add a property to the grid that lets me specify a debounce time for filtering. This way I can (for example) set the debounce time to 500(ms), and then only have the grid filter (which is slow) when the user stops typing (it current takes about 300ms per keypress anyway).
---
ADMIN EDIT
We are reopening this feature request because it can make sense for the FilterRow filter mode as an out-of-the-box feature, even if it can be achieved right now with a bit of application code (example).
---
When you scroll to the right in a grid and filter so that there are no items, the horizontal scroll disappears and you can no longer come back to the filter in order to clear it and work with the grid again.
If I add an await-ed call in the OnRowClick handler, then I cannot alter the grid state later in the code. It only works if the method is called again (e.g., a second click on the same row).
<AdminEdit>
This affects other Grid events too, for example, the PageChanged
</AdminEdit>
A workaround is to use synchronous code (remove the await call):
@inject IJSRuntime JsInterop
<TelerikGrid Data="@salesTeamMembers" OnRowClick="@OnRowClickHandler" @ref="@GridRef">
<DetailTemplate>
@{
var employee = context as MainModel;
<TelerikGrid Data="employee.Orders" Pageable="true" PageSize="5">
<GridColumns>
<GridColumn Field="OrderId"></GridColumn>
<GridColumn Field="DealSize"></GridColumn>
</GridColumns>
</TelerikGrid>
}
</DetailTemplate>
<GridColumns>
<GridColumn Field="Id"></GridColumn>
<GridColumn Field="Name"></GridColumn>
</GridColumns>
</TelerikGrid>
@code {
List<MainModel> salesTeamMembers { get; set; }
TelerikGrid<MainModel> GridRef { get; set; }
async Task OnRowClickHandler(GridRowClickEventArgs args) {
// After adding this line, it now requires a double click when the InvokeAsync call uses "await"
var width = JsInterop.InvokeAsync<int>("getWidth");
var model = args.Item as MainModel;
int index = salesTeamMembers.IndexOf(model);
//todo: you may want to take paging into account for example, or use js interop to get the index of the row based on contents from it like id
if (index > -1) {
var state = GridRef.GetState();
state.ExpandedRows = new List<int> { index };
await GridRef.SetState(state);
}
}
protected override void OnInitialized() {
salesTeamMembers = GenerateData();
}
private List<MainModel> GenerateData() {
List<MainModel> data = new List<MainModel>();
for (int i = 0; i < 5; i++) {
MainModel mdl = new MainModel { Id = i, Name = $"Name {i}" };
mdl.Orders = Enumerable.Range(1, 15).Select(x => new DetailsModel { OrderId = x, DealSize = x ^ i }).ToList();
data.Add(mdl);
}
return data;
}
public class MainModel {
public int Id { get; set; }
public string Name { get; set; }
public List<DetailsModel> Orders { get; set; }
}
public class DetailsModel {
public int OrderId { get; set; }
public double DealSize { get; set; }
}
}
The idea of the feature is to be able to customize the list of FilterOperators displayed in the list of the FilterRow and FilterMenu.
FilterRow UI element
FilterMenu UI element
Please expose an option to configure the field delimiter for CSV export. I want to set semicolon as field delimiter instead of a comma.
---
ADMIN EDIT
---
Internally the Grid uses SpreadStreamProcessing library to perform the export. That said, a necessary prerequisite to implement the current enhancement is that SpreadStreamProcessing supports settings for changing the delimiter when exporting to CSV. You may vote for the item and follow it to get status email updates.
For the time being, you may customize the exported file to set the desired field separator as suggested in the Grid CSV export - change the comma field delimiter knowledge base article.
The Grid selection performance is worse in WASM when there is a command column. Here is a test page with a large page size, which makes this more evident.
<label><TelerikCheckBox @bind-Value="@ShowCommandColumn" /> Show Command Column</label>
<TelerikGrid Data="@DataList"
SelectionMode="@GridSelectionMode.Single"
Height="700px">
<GridColumns>
<GridColumn Field="@(nameof(DataModel.Pos))" Title="Pos" />
@if (ShowCommandColumn)
{
<GridCommandColumn Width="300px">
<GridCommandButton Command="Save" Icon="save">Reset Volume</GridCommandButton>
<GridCommandButton Command="Delete" Icon="delete">Delete</GridCommandButton>
</GridCommandColumn>
}
</GridColumns>
</TelerikGrid>
@code {
bool ShowCommandColumn { get; set; } = true;
List<DataModel> DataList { get; set; }
protected override async Task OnInitializedAsync()
{
DataList = new List<DataModel>();
for (int i = 1; i <= 500; i++)
{
DataList.Add(new DataModel
{
Pos = i
});
}
}
public class DataModel
{
public int Pos { get; set; }
}
}
If LoadGroupsOnDemand="false", I am able to programmatically expand the groups through the state. However, this is not possible when loading group data on demand.
Please allow programmatically expanding the groups when LoadGroupsOnDemand="true". This should go together with an event (OnStateChanged?) that will fire when LOD groups are expanded or collapsed.