I want to be able to use interfaces and models that are created from a service when working with the grid. A parameterless constructor is not enough for me, I need to be able to instantiate models in a more complex manner.
---
ADMIN EDIT
The tentative event name I have put in the title might vary when the implementation is researched. The goal would still be the same - the grid to provide an event when it needs an instance of the model so you can provide it with one. At the moment this happens when a row enters edit mode, when the filter list needs to be built, and when you are inserting an item (a caveat with the last one might be the OnClick event for the command button - the new event might have to fire before OnClick so it can give you the model).
---
column virtualization is a great feature for wide table - and we would like to use keyboard navigation with it.
can both be supported together?
thanks
wei
*** Thread created by admin on behalf of this customer ***
Hi,
how to select ALL items in the grid data source using GridCheckboxColumn in the grid header when grid is in Virtual scroll mode?
When I click on the GridCheckboxColumn in the grid header it selects only the items in the current visible page but I would like to select all items in the grid data source.
Selecting all items in the grid (not only visible ones) is a must have feature and current behavoiur is kind of misleading because the user would expect that all items are selected.
ADMIN EDIT: This has been available since 2.10.0 through the SelectAllMode parameter of the selection column.
I have a column in the grid that is bound to a enum. The enum value names show up fine in the grid, but when exported, I get the underlying int value, which is incomprehensible to the users.
Thanks
---
ADMIN EDIT:
As a workaround you could generate the .xlsx file yourself. I'm attaching a sample project that allows you to do that. The relevant line of code is line 125 in Index.razor
---
My grid starts with Groupable=false and at some point I may need to make it groupable. The group panel appears, but I cannot drag the column headers to it to actually group.
---
ADMIN EDIT
A workaround is to hide the grid so it can re-initialize with the new groupable setting:
Is Groupable: @IsGroupable
<TelerikButton OnClick="@ToggleGroupable">Toggle Groupable</TelerikButton>
@if (isGridVisible)
{
<TelerikGrid Data=@GridData @ref="@GridRef" Groupable="@IsGroupable" Pageable="true" Height="400px">
<GridColumns>
<GridColumn Field=@nameof(Employee.Name) Groupable="false" />
<GridColumn Field=@nameof(Employee.Team) Title="Team" />
<GridColumn Field=@nameof(Employee.IsOnLeave) Title="On Vacation" />
</GridColumns>
</TelerikGrid>
}
@code {
bool IsGroupable { get; set; }
bool isGridVisible { get; set; } = true;
TelerikGrid<Employee> GridRef { get; set; }
async Task ToggleGroupable()
{
//save state (sorting, paging,...) - it will be lost when we hide the grid
var state = GridRef.GetState();
//hide the grid so it can later re-initialize with the new groupable setting
isGridVisible = false;
await InvokeAsync(StateHasChanged);
await Task.Delay(20);
IsGroupable = !IsGroupable;
isGridVisible = true;
//afte the grid re-initialized and rendered with the new setting, restore its state
await InvokeAsync(StateHasChanged);
await Task.Delay(20);
await GridRef.SetState(state);
}
public List<Employee> GridData { get; set; }
protected override void OnInitialized()
{
GridData = new List<Employee>();
var rand = new Random();
for (int i = 0; i < 15; i++)
{
GridData.Add(new Employee()
{
EmployeeId = i,
Name = "Employee " + i.ToString(),
Team = "Team " + i % 3,
IsOnLeave = i % 2 == 0
});
}
}
public class Employee
{
public int EmployeeId { get; set; }
public string Name { get; set; }
public string Team { get; set; }
public bool IsOnLeave { get; set; }
}
}
---
I would like to set increase the searchbox width with a parameter.
---
ADMIN EDIT
Here is a CSS workaround:
<style>
.custom-searchbox-width .k-grid-search {
width: 50%;
}
</style>
<TelerikGrid Data=@GridData Pageable="true" Height="400px" Class="custom-searchbox-width">
<GridToolBar>
<span class="k-toolbar-spacer"></span> @* add this spacer to keep the searchbox on the right *@
<GridSearchBox />
</GridToolBar>
<GridColumns>
<GridColumn Field="@(nameof(Employee.EmployeeId))" />
<GridColumn Field=@nameof(Employee.Name) />
<GridColumn Field=@nameof(Employee.Team) Title="Team" />
<GridColumn Field=@nameof(Employee.IsOnLeave) Title="On Vacation" />
</GridColumns>
</TelerikGrid>
@code {
public List<Employee> GridData { get; set; }
protected override void OnInitialized()
{
GridData = new List<Employee>();
var rand = new Random();
for (int i = 0; i < 15; i++)
{
GridData.Add(new Employee()
{
EmployeeId = i,
Name = "Employee " + i.ToString(),
Team = "Team " + i % 3,
IsOnLeave = i % 2 == 0
});
}
}
public class Employee
{
public int EmployeeId { get; set; }
public string Name { get; set; }
public string Team { get; set; }
public bool IsOnLeave { get; set; }
}
}
---
I want to place the Pager on top of the Grid. I know it can be handled with a Pager component integration in the Grid Toolbar, but I want to use the Toolbar for other purposes/actions. Please allow control over the Pager position.
Hi there,
currently the grid component does not provide a feature to set a specific position in virtual scrolling mode.
My team has currently implemented a workaround via javascript interop call to set a specific position. The workaround basically calculates the "scroll value" (we reverse engineered this value by looking at the Telerik js code) and passes it to the jQuery scrollTop() function. This results in an update of the scrollbar which in return triggers the OnReadItems event where we fetch the items based on the given skip and take values.
This workaround does not seem to work in all cases and is somewhat unreliable hence i'm requesting an official feature to set a specific position without the javascript hack.
What do you say?
So lonG
Daniel
Our application has, on many pages, complex business logic to enable or disable specific cells based upon the viewing mode, the user's capabilities, the type of data in the row, etc. If a cell is to be disabled, we also want to change the background color.. This is easily accomplished with the OnCellRender property.
However, we cannot enable/disable specific cells within a column without creating a column template with conditional logic. And so, in all our grids, EVERY column has to have a template, just for that trivial function. And now we have business logic smeared across both the razor page and the code page.
A template should be required only if you are doing something unusual or exceptional. Setting a cell to be enabled or disabled is completely routine, and one should not have to create a template just for that.
If you would add a property such as OnCellEnable, to override the column Enabled property on a per-cell basis, it would be extremely useful and would eliminate the need for literally hundreds of templates.
Thanks
I discovered "incell" editing mode on the grid, I love it! It makes the UI very intuitive and quick to update individual fields. It also works great with a PATCH API endpoint.
One minor glitch with "incell editing". If I click on a cell in a different row, it immediately takes the previous cell out of edit and puts the new cell in edit with a single click -- VERY cool. But, if you click on a cell in the same row it takes the previous cell out of edit, but doesn't put the new cell in edit mode. It would be cool if it worked the same as the "clicking in separate rows" functionality.
Thanks,
Kenny
Currently I need to define a custom JsonConverter to serialize the state of the grid. I would prefer not to have to do this, however I understand that may just be the way things are for now. Creating this ticket / issue to track if this is ever changed to not being needed.
For now I'll be setting up two serializers, one just for the grids that uses Newtonsoft, and the one I would prefer to use that uses System.Text.Json, https://github.com/Blazored/LocalStorage.
From https://docs.telerik.com/blazor-ui/components/grid/state
// to store the serialized grid state, we need to have a custom serialized // based on Newtonsoft.Json serialization. In the future this may not be required public class FilterDescriptorJsonConverter : JsonConverter {
///rest omitted
}
Using CheckBoxList filtering changes the filter menu for all columns. I would like to specify CheckBoxList only for certain columns, but that doesn't currently appear to be an easy option.
1) Leave as FilterMenuType "Menu" but implement a custom filter template for the columns I want. That would be the most obvious, but CheckBoxList is not a usable control on its own?
2) Or do the inverse, use FilterMenuType "CheckBoxList" and implement a custom filter template for all the columns where I don't want to use that. Seems like a lot of extra work to manually recreate default filters.
3) I guess I roll my own clone of the CheckBoxList control and use that like #1 on individual columns?
Any chance the CheckBoxList control could be publicly exposed for direct use?