Telerik Forums
UI for Blazor Forum
1 answer
234 views

Hi, I was working through converting a grid to TelerikGrid, referencing this document page:

https://www.telerik.com/blazor-ui/documentation/components/grid/editing/popup

Using GridEditMode.Popup.

Edit and Delete functionality was working.

New record functionality, however, was not.  It was triggering the correct dialog editing, but wouldn't trigger a dialog for adding a new record.  Instead it would fire my database code to add a record, with null data being passed.

I eventually figured out the example uses the OnCreate event, and I was using the OnAdd event.

This wasn't obvious to me, and there didn't seem to be anything in the documentation indicating you have to use OnCreate for the dialog to appear?

I then found this page which has more details on the events:

https://www.telerik.com/blazor-ui/documentation/components/grid/editing/overview

In the events section of the page, it states:

-

  • OnAdd - fires when the Add command button for a newly added item is clicked. The event is cancellable.
  • OnCreate - fires when the Save command button for a newly added item is clicked. Cancellable (cancelling it keeps the grid in Insert mode).

-

This isn't helpful either, and I'd go so far as to say it's incorrect?

If you have a GridCommandbutton like this:

<GridToolBarTemplate>
    <GridCommandButton Command="Add" Icon="@SvgIcon.Plus">Add New</GridCommandButton>
</GridToolBarTemplate>

And you are handling the OnAdd event, the event fires without giving the user a popup, and the data passed in the event is a null item.

If you are handling the OnCreate event, the user gets a popup, however the button to "add" is actually Update:

As you can see, there's neither an Add button to click or a Save button to click.

Perhaps this documentation is correct for other edit modes, but it seems to be misleading or flat out incorrect for Popup mode?

On a side note, the documentation also seems to switch back and forth between saying CUD and CRUD.  I can sort of understand why you omit the Read part, but it makes the documentation confusing and I'm not sure you correctly use CUD and CRUD in all the right places.  Furthermore, every other database documentation I've seen says CRUD, Read or not!

Dimo
Telerik team
 answered on 17 Jan 2025
1 answer
80 views

Hi,

I'm sure I'm being stupid but could anyone help with why the following classes are inaccessible when I try to follow the example at https://www.telerik.com/blazor-ui/documentation/knowledge-base/grid-custom-cell-formatting-with-radspreadstreamprocessing#custom-cell-formatting-of-the-exported-file-with-radspreadstreamprocessing ?

It's not like they are completely unrecognised, just inaccessible due to their protection level.

What am I missing?

Thanks,

Dean

'CellValueType' is inaccessible due to its protection level
'IWorkbookImporter' is inaccessible due to its protection level
'SpreadImporter' is inaccessible due to its protection level
'IWorksheetImporter' is inaccessible due to its protection level
'IWorkbookImporter.WorksheetImporters' is inaccessible due to its protection level
'IWorksheetImporter.Name' is inaccessible due to its protection level
'IRowImporter' is inaccessible due to its protection level
'IWorksheetImporter.Rows' is inaccessible due to its protection level
'IRowImporter.RowIndex' is inaccessible due to its protection level
'ICellImporter' is inaccessible due to its protection level
'IRowImporter.Cells' is inaccessible due to its protection level
'ICellImporter.Value' is inaccessible due to its protection level
'ICellImporter.Format' is inaccessible due to its protection level
'ICellImporter.ColumnIndex' is inaccessible due to its protection level
'ICellImporter.RowIndex' is inaccessible due to its protection level
'ICellImporter.ColumnIndex' is inaccessible due to its protection level
'IRowImporter.RowIndex' is inaccessible due to its protection level

Dimo
Telerik team
 answered on 17 Jan 2025
0 answers
129 views

Hi,

in my existing project I use custom filter rows for the grid:

 

<GridColumn Field="@column.DbName" FieldType="@type" Title="@column.HeaderName.Sanitize()" Width="@(column.DbName == nameof(Worker.BinderId) ? "230px" : "200px")" Lockable="true">
    <FilterCellTemplate>
        @if (type == typeof(string))
        {
            <CustomTextRowFilter Context="@context"/>
        }
        else if (type == typeof(int) || type == typeof(int?) || type == typeof(decimal) || type == typeof(decimal?))
        {
            <CustomNumberRowFilter Context="@context"/>
        }
        else if (type == typeof(DateTime) || type == typeof(DateTime?))
        {
            <CustomDateRowFilter Context="@context"/>
        }
        else if (type == typeof(bool) || type == typeof(bool?))
        {
            <CustomBooleanRowFilter Context="@context"/>
        }
    </FilterCellTemplate>

 

Furthermore I use the OnStateInit and OnStateChanged events so save and restore user settings for filters, groupings etc.


private async Task OnStateInitHandler(GridStateEventArgs<object> args)
{
    ShowSpinner = true;
    var stateValue = await AppStateService.GetAppStateAsync(SelectedProjectGuid, CurrentUser.Id, AppStateType.GridWorkerState);

    if (!string.IsNullOrWhiteSpace(stateValue))
    {
        var state = AppStateHelper.GetItem<GridState<object>>(stateValue);

        if (state != null)
        {
            await CleanGridState(state);
            args.GridState = state;
        }
    }

    ShowSpinner = false;
}

 

With the filter's initialization I set the value and operator:


protected override Task OnInitializedAsync()
{
    Field = ((FilterDescriptor) Context.FilterDescriptor.FilterDescriptors[0])?.Member;
    SetValue(((FilterDescriptor)Context.FilterDescriptor.FilterDescriptors[0]).Value);
    SetOperator();
    return base.OnInitializedAsync();
}

 

Up to now every time the grid was loading the filter values have been set correctly and the grid has filtered the records.

Now, after updating to a new Telerik version, the grid still filters correctly. But the filter component doesn't get the values and so doesn't show them.

The reason is:

Before update the process was... Init grid -> OnStateInit -> Init filter component

Now it is... Init grid -> Init filter component -> OnStateInit

So, the grid state is pulled too late.

Has the init sort order been changed? How can I get this solved?

 

Best regards,

Rayko

Rayko
Top achievements
Rank 1
Iron
Iron
Iron
 asked on 17 Jan 2025
2 answers
308 views

Hello, 

I am currently experimenting with the ChipList component and the documentation suggests that it delivers the same customization options as the Chip component. However, I am unable to find a way to change the ThemeColor of the chips. Is this feature supported, and if so, how can it be implemented?

Reference that suggests this is possible: Blazor ChipList

Customization

Built on top of the existing Blazor Chip component, the Telerik UI for Blazor ChipList delivers the same customization options to meet any design requirements. These include the color and style of the ChipList, whether to display a close or delete icon and whether to add avatars or images as part of the ChipList content.

Thanks 



Michael
Top achievements
Rank 1
Iron
 answered on 17 Jan 2025
1 answer
145 views
Hello
I need to use something like Image Button in Grid that redirects the user to another page by clicking on it.
I used the following code but I can't change its icon and put my own icon.

<GridCommandColumn>
<GridCommandButton Command="MyOwnCommand"
		Icon="@SvgIcon.InfoCircle"
		ThemeColor="@ThemeConstants.Button.ThemeColor.Tertiary"
		OnClick="@MyCustomCommandOnClickHandler">click Me</GridCommandButton>
</GridCommandColumn>
Grid is dynamic and is set with ExpandoObject.
Please help.
Thanks
Dimo
Telerik team
 answered on 16 Jan 2025
1 answer
79 views

Hi,

in a Blazor Grid with Column Virtualization and multiple ow selection enabled, when I use the "Select all" option the column virtualization doesn't load any further values on scrolling.

I took an example from the Telerik docs and added a checkbox column:

https://blazorrepl.telerik.com/QzOPbePP34Fw94E733

Is there any solution for this?

 

Best regards,

Rayko

Tsvetomir
Telerik team
 answered on 16 Jan 2025
1 answer
102 views

I'm trying to reference a TelerikComboBox in a razor component, but it keeps returning null.
(I'm using version 6.2.0)

Any clues?

Html:

<TelerikComboBox Class="hide-combobox-buttons" 
                 Data="@AllLabels" 
                 Value="@Label"
                 @ref="ComboBoxRef"
                 ValueChanged="@((string newValue)=> ValueChanged(newValue))"
                 AllowCustom="true">
</TelerikComboBox>

 

@code{

 private TelerikComboBox<string, string>? ComboBoxRef { get; set; }

 [Parameter]
 public IReadOnlyList<string>? AllLabels { get; set; }

 private string Label { get; set; } = string.Empty;

 protected override async Task OnInitializedAsync()
 {
     if (ComboBoxRef != null) //here it's always null
         await ComboBoxRef.FocusAsync();

     await base.OnInitializedAsync();
 }

}

Dimo
Telerik team
 answered on 16 Jan 2025
2 answers
266 views
Hello
I need a DatePicker with solar or Jalali or  hijri or Persian calendar.
Please help me.
Thanks
Mohamad Javad
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 15 Jan 2025
1 answer
147 views

Background: Grid bound to a List provided by EF from SQL data source.  Pageable=true. EditMode=Incell.

Process:

1.  User clicks Add button

2.  In the Add event handler for the button, a new object instance is created and added to the List that is Data bound to the grid (last item in the List not an Insert ... this is a user requirement and must be added to end of List)

3.  StateHasChange(), Grid?.Rebind 

4.  Force the grid to scroll to the last item.

I researched and found this Telerik documentation Scroll to Selected Grid Row and it suggests I have to use JavaScript "scrollIntoView()"??  I absolutely do NOT want to go this route for what should be a very simple process.  Please tell me there is a better way?

I was "hoping" I could use SelectionMode=Single and bind SelectedItemsInPage and then programmatically set the SelectedItem to the last item in the List (Data=) and Telerik Grid would do the control update to appropriate page and make the last row visible in the grid.  Unfortunately this is not the case. 

Do you folks have a more Blazor-Server like approach for .NET 9 and 7.1.0 suite?

Rob.

Dimo
Telerik team
 answered on 15 Jan 2025
1 answer
84 views

I have a DeleteHandler:

    private async Task OnDeleteAsync(GridCommandEventArgs args)

    {
        if (ViewModel == null)                    throw new InvalidOperationException("ViewModel == null");
        if (!(args.Item is ProductUi product_ui)) throw new InvalidOperationException("!(args.Item is ProductUi product_ui)");
        if (product_ui.Id == null)                throw new InvalidOperationException("product_ui.Id == null");

        var result = await ViewModel.DeleteUiAsync(product_ui.Id.Value);

        if (result.Error != null)
            await Dialogs!.AlertAsync(result.Error, "Delete Error");
    }

If there is an error I try to display it using one of Telerik's standard Dialogs.

If there is an error the dialog is displayed, however the grid then displays a busy spinner and the entire window is disabled.

There is now a deadlock, can't close the dialog because the grid has disabled input, the grid is busy because it is waiting for the dialog.

Dimo
Telerik team
 answered on 15 Jan 2025
Narrow your results
Selected tags
Tags
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?