Telerik Forums
UI for Blazor Forum
1 answer
987 views
Copied a demo TelerikScheduler:
<TelerikScheduler Data="@RFCactions"
                  @bind-Date="@StartDate"
                  Height="600px" 
                  @bind-View="@CurrView"
                  AllowCreate="false" AllowDelete="false" AllowUpdate="false"
                  ConfirmDelete="true"
                  IdField="@(nameof(RequestForChangeActionSched.Id))"
                  StartField="@(nameof(RequestForChangeActionSched.StartingDate))"
                  EndField="@(nameof(RequestForChangeActionSched.EndingDate))"
                  IsAllDayField="@(nameof(RequestForChangeActionSched.IsAllDay))"
                  TitleField="@(nameof(RequestForChangeActionSched.RequestForChangeId).ToString())"
                  DescriptionField="@(nameof(RequestForChangeActionSched.Activity))">
    <SchedulerViews>
        <SchedulerDayView StartTime="@DayStart" EndTime="@DayEnd" WorkDayStart="@WorkDayStart" WorkDayEnd="@WorkDayEnd" />
        <SchedulerWeekView StartTime="@DayStart" EndTime="@DayEnd" WorkDayStart="@WorkDayStart" WorkDayEnd="@WorkDayEnd" />
        <SchedulerMultiDayView StartTime="@DayStart" EndTime="@DayEnd" WorkDayStart="@WorkDayStart" WorkDayEnd="@WorkDayEnd" NumberOfDays="31" SlotDivisions="4" >
            <DateHeaderTemplate>
                <div>
                    @context.ToString("ddd dd")
                </div>
            </DateHeaderTemplate>
        </SchedulerMultiDayView>
        <SchedulerMonthView></SchedulerMonthView>
        <SchedulerTimelineView StartTime="@DayStart" EndTime="@DayEnd" WorkDayStart="@WorkDayStart" WorkDayEnd="@WorkDayEnd" />
    </SchedulerViews>
</TelerikScheduler>

@code {
    List<RequestForChangeActionSched> RFCactions = new List<RequestForChangeActionSched>();
    ....etc
Made sure all required fields are in my model, with the same datatypes
But the (any) view won't show because of an InvalidCastException
Updated from V2023.1.313.33 to V2023.1.426.51 but still got the cast error at blazor.webassembly.js:1  

System.InvalidCastException: Specified cast is not valid.
   at Telerik.Blazor.Components.TelerikScheduler`1[[MISFrontEnd.Shared.Domain.RequestForChangeActionSched, MISFrontEnd.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].UpdateAppointment(RequestForChangeActionSched dataItem, IAppointment appointmentForUpdate)
   at Telerik.Blazor.Components.TelerikScheduler`1[[MISFrontEnd.Shared.Domain.RequestForChangeActionSched, MISFrontEnd.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].CreateAppointment(RequestForChangeActionSched dataItem)
   at Telerik.Blazor.Components.TelerikScheduler`1[[MISFrontEnd.Shared.Domain.RequestForChangeActionSched, MISFrontEnd.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].ExpandAppointments()
Maarten
Top achievements
Rank 1
Iron
 answered on 12 May 2023
0 answers
254 views

I have a grid that loads big data. We used to use the ObservableCollection but opted to use the OnRead for better performance (loading takes time when using ObservableData). We have EventAggregators and PropertyChanged events running async OnInitialised().. Does this affect the OnRead event? We manually track the Add, Edit/Update, Delete and Duplicate actions on the grid.

So upon running our blazor app, the grid won't load the data on the grid and has the loading animation on endless loop. (Tried waiting for it to load for about 2 hours). Also tried debugging line per line from which I saw that upon executing the OnRead, the args,Data and args,Total were popullated properly.

Kat
Top achievements
Rank 2
 asked on 12 May 2023
1 answer
362 views
I have a Blazor Grid with the following properties:
<TelerikGrid 
                         OnRead="@OnGridRead"
                         Data="Data"
                         Pageable="true"
                         PageSize="10"
                         Width="100%"
                         Sortable="true"
                         Navigable="true"
                         Groupable="true"
                         SelectionMode="GridSelectionMode.Single"
                         SortMode="@SortMode.Single"
                         FilterMode="@GridFilterMode.FilterMenu"
                         Resizable="true"
                         OnRowClick="OnRowClickCallback"
                         Reorderable="true"
                         AutoGenerateColumns="true">
When I click on a row the row is highlighted, but when I use the keyboard to navigate the highlight stays on the last row I clicked on.

The keyboard navigates to a cell and draws a thin, barely visible, border on the cell, when I hit enter the `OnRowClickCallback` is called on the new row but the highlight remains on the old row.

How do I get the row highlight to change with the navigation?
Dimo
Telerik team
 answered on 12 May 2023
1 answer
167 views

I have a grid that displays financial information nicely. However, I need a second grid to access the selected row from the first grid so that it can display further details.

First (fully functioning) grid in brief:

                <TelerikGrid Data="@vm.Model.CO_DetailsList"
                     @ref="grid"
                     EditMode="@Telerik.Blazor.GridEditMode.Incell">
            
                    <GridColumns>
                        <GridColumn Field="@nameof(CO_Details.Seg0)" Title="Fund" Width="70px">
                            <EditorTemplate>
                                <TelerikComboBox Data="@vmSeg0.Model"
                                             TextField="Value"
                                             ValueField="Value"
                                             TItem="GL_Seg0RO"
                                             TValue="string"
                                             @bind-Value="vm.Model.CO_DetailsList[index].Seg0">
                                    <ComboBoxSettings>
                                        <ComboBoxPopupSettings MaxHeight="@seg0CmbHeight"/>
                                    </ComboBoxSettings>
                                </TelerikComboBox>
                            </EditorTemplate>
                        </GridColumn>
                    </GridColumns>
                </TelerikGrid>

Dimo
Telerik team
 answered on 10 May 2023
2 answers
824 views

I am stuck with a problem that I just can't seem to solve:

I have built a TelerikForm with a Submit button. The requirement is to change the enabled status of this button depending on whether the form has been modified or not.

So the basic code is :

 


<TelerikForm @ref="@FormRef"
             Model="@EntityModel"
             OnSubmit="@OnSubmitHandler"
             >
    <FormValidation>
        <DataAnnotationsValidator />
    </FormValidation>
    <FormItems>
        <CascadingValue Name="TheForm" Value="@FormRef">
            @foreach (var form_item in FormItemCollection)
            {
                <DynamicComponent Type="@form_item.ComponentType" Parameters="@form_item.Parameters" />
            }
        </CascadingValue>
    </FormItems>
    <FormButtons>
        <TelerikButton 
                      ButtonType="@ButtonType.Submit"  
                       Enabled="@SaveEnabled"
                       ThemeColor="primary">Speichern</TelerikButton>
    </FormButtons>

</TelerikForm>

The ButtonShould be changed on the EditContext.IsModified() state.

So I tried:

protected override void OnAfterRender(bool firstRender)
    {
        if (firstRender)
        {
            FormRef.EditContext.OnFieldChanged += EditContext_OnFieldChanged;
        }
        base.OnAfterRender(firstRender);
    }

    private void EditContext_OnFieldChanged(object sender, FieldChangedEventArgs e)
    {
        SaveEnabled = true;
        StateHasChanged();
    }

But every time the StateHasChanged() is called, I lost the new values in the form cause it is rendered again with the previos values.

I can't find any solution to change the State of the Button without StateHasChanged. The enabled attribute is not a bound value, so the state does not change. 

So how to solve this troubles?
Peter
Top achievements
Rank 1
Iron
Iron
 updated answer on 09 May 2023
1 answer
271 views

I have a main grid that can have 300+ rows.

Within that each row can be expanded to a sub grid with say 100 rows.

And then each row within that has 4 sub grids that can have 20-30 rows.

I have it built and working but on large accounts this runs way too slow!

Each grid has its own class and there are loops filling in each grid.

I am looking for a faster way to load those grids.

I am wonder if I could be pointed in the direction of an example that shows say how to load each sub grid on the fly when its parent grid is expanded.

Thanks in advance.

Deasun

Deasun
Top achievements
Rank 3
Bronze
Bronze
Bronze
 answered on 09 May 2023
0 answers
136 views

Hello, 

I have the following grid:

<TelerikGrid Data="@Customers"
                 Pageable="false"
                 Sortable="true"
                 ScrollMode="@GridScrollMode.Virtual"
                 OnRead="@ReadItems"
                 LoadGroupsOnDemand="true"
                 FilterMode="@GridFilterMode.FilterRow"
                 PageSize="20">
        <GridColumns>
            <GridColumn Field="Number" Title="Nr" Width="150px" />
            <GridColumn Field="Zip" Title="ZIP"></GridColumn>
            <GridColumn Field="City" Title="City"></GridColumn>
            <GridColumn Field="FirstName" Title="First"></GridColumn>
            <GridColumn Field="LastName" Title="Last"></GridColumn>
        </GridColumns>
    </TelerikGrid>

with code-behind:

public async Task<DataEnvelope<CustomerDTO>> FetchPagedData(DataSourceRequest dataSourceRequest)
{
        var result = await Http.PostAsJsonAsync(ApiRoutes.Customer.POST_Lazy(), dataSourceRequest);
        var fullList = await result.Content.ReadFromJsonAsync<DataEnvelope<CRMCustomerDTO>>();
        return fullList;
 }

protected async Task ReadItems(GridReadEventArgs args)
{
        var dataResult = await FetchPagedData(args.Request);

        if (args.Request.Groups.Count > 0)
        {
            args.Data = dataResult.GroupedData.Cast<object>().ToList();
        }
        else
        {
            args.Data = dataResult.CurrentPageData.Cast<object>().ToList();
        }

        args.Total = dataResult.TotalItemCount;

        StateHasChanged();
}

and web-api:

[HttpPost("Lazy")]
public async Task<DataEnvelope<CustomerDTO>> GetLazy([FromBody] DataSourceRequest dataSourceRequest)
{
            DataEnvelope<CustomerDTO> dataEnvelope = new();

            var customers = await _context.Customer
                                            .Include(c => c.Address)
                                            .ToListAsync();

            var customerDTOs = _mapper.Map<List<CustomerDTO>>(customers);


            DataSourceResult result = customerDTOs.ToDataSourceResult(dataSourceRequest);

            if (dataSourceRequest.Groups.Count > 0)
            {
                dataEnvelope = new DataEnvelope<CustomerDTO>
                {
                    GroupedData = result.Data.Cast<AggregateFunctionsGroup>().ToList(),
                    TotalItemCount = result.Total
                };
            }
            else
            {
                dataEnvelope = new DataEnvelope<CustomerDTO>{
                    CurrentPageData = result.Data.Cast<CustomerDTO>().ToList(),
                    TotalItemCount = result.Total
                };
            }

            return dataEnvelope;
}

Now, when im calling the method FetchPagedData() the filters are set correctly.
However, in GetLazy() the filters are not. The correct amount of filters is set, but every set filter is empty with the operator IsEqualTo.

Why is that and how can I fix it?
I tried building my own object with the filters and recreate it from there, but I can't access the members of IFilterDescriptor.

 

Any help is much appreciated!

Colin
Top achievements
Rank 1
 asked on 08 May 2023
1 answer
940 views

Hi all, 

I want to edit the text "Drag a column header and drop it here to group by that column" to another text with a specific column's name. Please help me!!!

Thank you,

Dimo
Telerik team
 answered on 06 May 2023
1 answer
695 views

Hi,

Filtering and editing grid columns of the type datetimeoffset doesn't currently seem to be supported.

 

Is there anyway to work around this?

Currently the datetimepicker supports datetimeoffset so for consistency it should be supported in the gird aswell, is this something that will be fixed in future releases?

Nadezhda Tacheva
Telerik team
 answered on 05 May 2023
1 answer
171 views

By default the Breadcrumb appears to fade the last item (page you're currently on) as seen on the screenshot attached. Is there anyway to remove this affect, I would like it instead to have the text bolded to represent the current breadcrumb. Is this possible to remove and if so, how?

 

Radko
Telerik team
 answered on 04 May 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?