Telerik Forums
UI for Blazor Forum
1 answer
180 views
I have a problem in the Grid, I have created a calculated field that for the example is the calculated date, this field does not belong to the TelerikGrid Data model, when clicking on the column header of said field an error occurs. It is very necessary to perform calculations and display them in a column, the data in my project is generated from a dbcontext, so I do not want to alter the SQL tables that I have been managing. There is a way to avoid this error, the error occurs even when removing the filter from the column, please, if someone has a solution it would help me out of trouble.

https://blazorrepl.telerik.com/GRPYFhvp14M25Tft34


@page "/Grid"

@using Telerik.Blazor.Services
@using Telerik.FontIcons;
@using Telerik.Blazor.Components.Grid

<TelerikGrid Data="@GridData" Height="550px" FilterMode="@GridFilterMode.FilterMenu"
                         Sortable="true" Pageable="true" PageSize="20" Groupable="true" Resizable="true" Reorderable="true">
    <GridColumns>
        <GridColumn Field="@nameof(Product.Name)" Title="Name"/>
        <GridColumn Field="@nameof(Product.Price)" DisplayFormat="{0:C2}" />
        <GridColumn Field="@nameof(Product.Released)" DisplayFormat="{0:D}" />
        <GridColumn Field="@nameof(Product.Discontinued)" />
        <GridColumn Field="Date Calculated (NO PRESENT IN MODEL)" Width="220px" DisplayFormat="{0:dddd, dd MMM yyyy}">
                        <Template>
                            @{
                                var fecha = (Product)context;
                                double FechaCalculada;
                                TimeSpan diferencia = DateTime.Today - fecha.Released;
                                double difDouble = 5+diferencia.TotalDays / 365.25; // considerando aƱos bisiestos
                                FechaCalculada = Math.Round(difDouble, 2);
                            }
                            <TelerikNumericTextBox Decimals="2" @bind-Value=@FechaCalculada DebounceDelay="200" Enabled=false Arrows="false" />
                        </Template>
                    </GridColumn>
    </GridColumns>                    
</TelerikGrid>



@code {
    private List<Product> GridData { get; set; }

    protected override void OnInitialized()
    {
        GridData = new List<Product>();

        var rnd = new Random();

        for (int i = 1; i <= 30; i++)
        {
            GridData.Add(new Product
                {
                    Id = i,
                    Name = "Product name " + i,
                    Price = (decimal)(rnd.Next(1, 50) * 3.14),
                    Released = DateTime.Now.AddDays(-rnd.Next(1, 365)).AddYears(-rnd.Next(1, 10)).Date,
                    Discontinued = i % 5 == 0
                });

        }
    }

    public class Product
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public decimal Price { get; set; }
        public DateTime Released { get; set; }
        public bool Discontinued { get; set; }
    }
}




Kind regards.



Hristian Stefanov
Telerik team
 answered on 20 Oct 2023
1 answer
143 views

I have a main grid that has 4 rows.

The top 3 rows have numeric data and formatted as: $0,00.00 etc.

The 4th row has percentage data in the cells. should be formatted as 0.00% or just 0.00.

Currently the data is showing up as $0.00

I am not sure how one would do that.

Any pointers?

 

Georgi
Telerik team
 answered on 19 Oct 2023
1 answer
275 views
Checkbox shows default tabindex="-1" but would like for users to be able to tab through grid
Dimo
Telerik team
 answered on 19 Oct 2023
1 answer
149 views

Ok I have a grid with many pages and a total of say 1million plus rows!

User filters this grid down to say 7000 rows.

When I click the export all button it will export the rows they filtered. Alls good.

But when they export the whole dataset I have to intercept that to do the export myself and email them a link to it.

My issue is I cant seem to find a way to figure out how many rows are in the filtered version.

So currently I have: ( in the async Task gridRpt_OnBeforeExcelExport(GridBeforeExcelExportEventArgs args) )

If the grid.count > 1000000

then go do my email export procedure

ELSE do the grids default export.

Problem is when the grid is filtered That grid.count is still the big dataset count not the filtered count.

How do I know the filtered count and if that filtered count is still over 1mil how to I export only that filtered set?

 

Hope that makes sense.

Thanks

Deasun.

 

 

 

Dimo
Telerik team
 answered on 19 Oct 2023
1 answer
125 views

With ChartCategoryAxes, is it possible to label the group and then each column within it? For example, https://blazorrepl.telerik.com/QdbaPgbU17q4epgO21:

  1. We have tried to use ChartCategoryAxisLabel templates. But without HTML to enable styling it is difficult to space the elements evenly.
  2. We have tried adding an invisible series at the top of the stacked series with a label, but on dark backgrounds the invisible series is revealed on hover. We can use brittle CSS selectors to hide the hover but ideally our label would be beneath the chart, within the axis. 

 

Dimo
Telerik team
 answered on 19 Oct 2023
1 answer
178 views

So we are building a component comprised of a high number of child components (think of a page with lots of controls on it). Ideally I want to use the TelerikTooltip for every child control component to display a tooltip on hover. However when we get above 140 child components the initial load performance of the ui gets significantly slower.

I am testing with a baseline of 500 child components and using the TelerikTooltip delays the render by about 13 seconds when compared to my own attempts at a tooltip (or not using it at all).

Are there any known performance tricks for the TelerikTooltip or anything in the pipeline for performance improvements with the TelerikTooltip?

Code snippet below where ComponentVM.ControlVMs has 500 objects:

foreach (IControlVM nextControl in ComponentVM.ControlVMs)
    {
        ControlName = nextControl.FormControlVM.FormControl.GetType().Name;
        <TelerikTooltip TargetSelector=".tooltip-target" Class="menu-tooltip" />
        
        <div style="position:absolute; 
                   z-index:@nextControl.FormControlVM.ZIndex;
                   border-radius:2px; border-width:2px; border-color:red; 
                   width:@string.Format("{0}cm", nextControl.FormControlVM.Width); 
                   height:@string.Format("{0}cm", nextControl.FormControlVM.Height);
                   left:@string.Format("{0}cm", nextControl.FormControlVM.CanvasLeft);
                   top:@string.Format("{0}cm", nextControl.FormControlVM.CanvasTop);
                   overflow:hidden;">

            @if (ControlRazors.ContainsKey(ControlName))
            {
            Dictionary<string, object> controlParams = new Dictionary<string, object>()
            {
                {nameof(ComponentVM), nextControl}
            };
                <DynamicComponent Type="ControlRazors[ControlName]" Parameters="controlParams" />

            }

            </div>
    }

Georgi
Telerik team
 answered on 18 Oct 2023
2 answers
433 views

If you use the Blazor repl link below and make the dimensions of the signature pad relatively large and you draw two lines in quick succession it sometimes doesn't draw the second line correctly.

For example, if I make the width 1000px and the height 400px (or more) and attempt to use my mouse to write my own name which starts with a D, I can draw the vertical line first and if I draw the curved line to complete the D too quickly it will sometimes draw a straight line from start to finish rather than following the curve that I made with the mouse. It's like there's some sort of lag occurring before you can draw a second line. If I wait a couple seconds before drawing the second line it works. The larger you make the signature pad the more pronounced this issue is. You can also see this if you use your mouse to draw several random lines in quick succession.

When the dimensions are smaller, say 500px x 200px it mostly works okay, but if I have a user running a big ipad pro then having to limit the signature pad size like that isn't going to work very well. Is there any way to resolve this?

https://blazorrepl.telerik.com/QnYKEGvE34EIrAdC04?_ga=2.93311705.595058249.1696447250-1661447875.1621547203&_gl=1*1yfgby6*_ga*MTY2MTQ0Nzg3NS4xNjIxNTQ3MjAz*_ga_9JSNBCSF54*MTY5NjU0MTk5Ni4yOTQuMC4xNjk2NTQxOTk2LjYwLjAuMA..

Doug
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 17 Oct 2023
1 answer
306 views

Hi,

Is there a way of having a timespan (or duration) component in Blazor at all, like the one mentioned here for Xamerin:

https://www.telerik.com/blogs/choose-time-duration-telerik-timespan-picker-xamarin

Apologies if I have missed it in the docs.

Regards,

Rawden.

Hristian Stefanov
Telerik team
 answered on 17 Oct 2023
2 answers
641 views

Hi - can someone please point me towards definitive documentation for all the Telerik CSS classes and how they work with the Telerik UI for Blazor components - and for other html elements too? I don't mean documentation on how to install/configure the actual styles/style sheets - I mean documentation on the actual css classes themselves.

(I'm using the default theme - but it would be good to have CSS docs for the other themes too.)

For example, I see examples that use classes like "k-d-flex-col k-align-items-center k-justify-content-evenly" ... I can guess what they do from the context, but it would be nice to see some nicely organized documentation on these and other "k-..." classes and how to use them.

Thanks,

Tim.

Mark
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 17 Oct 2023
0 answers
110 views

Hi there

We have a Scheduler with three resources defined which is working as expected. I've removed a bunch of tags for simplicity:

<TelerikScheduler
    Data="@Flights"
    AllowCreate="true"
    AllowDelete="false"
    AllowUpdate="true"
    OnEdit="@Edit">
    <SchedulerResources>
        <SchedulerResource
            Field="@nameof(Flight.SquadronEntityRowId)"
            Title="Squadron"
            Data="@_allSquadrons"
            TextField="@nameof(Squadron.Name)"
            ValueField="@nameof(Squadron.SquadronEntityRowId)"
        />
        <SchedulerResource
            Field="@nameof(Flight.AircraftEntityRowId)"
            Title="Aircraft"
            Data="@_allAircraft"
            TextField="@nameof(Aircraft.TailFinId)"
            ValueField="@nameof(Aircraft.AircraftEntityRowId)"
            ColorField="@nameof(Aircraft.Colour)"
        />
        <SchedulerResource
            Field="@nameof(Flight.AircraftType)"
            Title="Aircraft Type"
            Data="@SelectedAircraftTypes"
            TextField="@nameof(AircraftType.Name)"
            ValueField="@nameof(AircraftType.AircraftTypeEntityRowId)"
            ColorField="@nameof(AircraftType.Color)"
            />
    </SchedulerResources>
    <SchedulerSettings>
        <SchedulerGroupSettings Resources="@(new List<string> { nameof(Flight.SquadronEntityRowId) })" Orientation="@SchedulerGroupOrientation.Horizontal"></SchedulerGroupSettings>
    </SchedulerSettings>
</TelerikScheduler>

As you can see, we have grouping defined on one of the resources. This seems to work in the UI (aircraft and groups redacted for client confidentiality):

However, despite having set AllowCreate="true", when doubling clicking an empty slot the OnEdit event doesn't fire.

If I clear resource grouping however, double clicking then fires the edit event as expected:


Can someone please help us understand why creating new appointments when resource grouping is on isn't working? Is this intended behaviour?

Cheers,

Paul

Paul
Top achievements
Rank 1
 asked on 16 Oct 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?