I have created a Grid to display a list of rows from a database. I want to have two columns more than the table gives me - one for a text box and one for a submit button. I need the button's OnClick method to be able to access the entire row. Here's what I've got (simplified) and the final text column is not editable:
@page "/pathto/page"
@using Solution.Shared.Models;
@inject HttpClient Http
<TelerikLoader Visible="@(Results == null)" Size="@ThemeConstants.Loader.Size.Medium" />
@if (Results is not null)
{
<TelerikGrid Data="@Results"
TItem="@Result"
@ref="@Grid"
EditMode="@GridEditMode.Inline"
OnCreate="@Submit"
Class="auto-table"
Resizable="true"
Sortable="true"
Pageable="true"
PageSize="15"
Height="auto"
>
<GridToolBar>
<GridCommandButton Command="ExcelExport" Icon="file-excel">Export to Excel</GridCommandButton>
</GridToolBar>
<GridColumns>
<GridColumn Field="@nameof(Result.Username)" Width="8%" Editable="false" Groupable="true">
<Template>
@{
string? username = (context as Result)?.username;
<LinkToAnotherPage Username="@username" Link />
}
</Template>
</GridColumn>
<GridColumn Field="@nameof(Result.display_name)" Title="Name" Width="8%" Editable="false" />
<GridColumn Field="@nameof(Result.Date)" Title="Date" Width="4%" Editable="false" DisplayFormat="{0:MM/dd/yyyy}" />
<GridColumn Field="@nameof(Result.EditableColumn)" Title="Save This Value" Editable="true" Width="18%" />
<GridCommandColumn Title="Approve" Width="3%">
<GridCommandButton Command="Add" Icon="checkmark" ShowInEdit="true" />
</GridCommandColumn>
</GridColumns>
</TelerikGrid>
}
@code {
List<Result>? Results;
private TelerikGrid<Result>? Grid;
protected override async Task OnInitializedAsync()
{
Results = await Http.GetFromJsonAsync<List<Result>>("Controller/Action");
}
private async Task Submit(GridCommandEventArgs args)
{
var ex = args.Value; // this should be the edited column
Result res = (Result)args.Item;
// do stuff with res and ex variables
}
}
Can I bind to the value of the editable column's content when the row is clicked?
Is there a better way to do this?
I track changes inside my Objects to enable/disable for example Save or Cancel Buttons in the very moment the user hits a key.
Inside my Object I have a Dictionary that list all Properties that have changed during time.
I would like to change the Border/Background/Whatever of each Textbox that have changed. I would like to avoid having a Class for each Textbox and I am looking for a kind of generic approach. I am missing an Event like "OnCellRenderHandler" of the Grid-Control.
What would be the best solution ? The solution should cover Comboboxes, too...
I would be very pleased to get an answer, maybe it is simple but I am still a novice in Terms of Blazor...
How would I go about adding a tool tip on hover to items on a Telerik Menu using Telerik UI for Blazor?
Thanks.
Hello.
Just a simple question: How to hide the placeholder when the datepicker is disabled or not editable.
As an example, I don't want to show the placeholder of the "Last response" field when the input is disabled.
Regards.
Twain.
Hi
I wonder if it is possible to add a kind of footer to the drawer.
For example, whe could have the navigation buttons on the top (like usual) and some buttons on the bottom ( ex : admin and user profile )
How can i archieve this ?
Thanks
Hello!
It is possible to change appearance settings for line' markers?
Need to change at least the size and thickness of the border.
The current settings look bad with a sufficiently large amount of data (1-100)
Especially since it is planned to connect several data series - everything will merge into a heap.
And in second - it would be great to implement an event to change the width of the navigator span.
In the current view, redrawing the chart resets the From - To values to the original ones, which is inconvenient.