Telerik Forums
UI for Blazor Forum
1 answer
244 views

I have a very wide grid with a horizontal scrollbar and the first few columns are frozen so this info stays in the screen. This works well until I use grouping and collaps the various grouped data.

 

If you expand the grouped data the frozen columns stays visible and all is fine.

If you collaps the grouped data the text in the frozen columns aren't visible and if you scroll to the right the header field of the grouping is gone.

in the picture I have grouped by employee and scrolled to the right

Marin Bratanov
Telerik team
 answered on 05 Apr 2021
1 answer
987 views

During rendering I often get this error. Sometimes I am able to find what mistake I made and fix it. But from the stacktrace in the Chrome debugger it is hard to figure out what is going on. I am working on a WASM project. I was wondering if there were any tips on how to debug issues like this?

 

Marin Bratanov
Telerik team
 answered on 05 Apr 2021
1 answer
618 views

Iam using Telerik Blazor grid in one of my application. The grid displays a list of items along with the  itemType. I need to implement a feature where users can select the items using a checkbox. I have done that using the GridCheckboxColumn. Now I want to limit the user to only select one item of a specific itemType. Such that the selected items will always belong to a distinct item type. No two items of the same itemType can be selected.

Is this possible in the current version? Could you point me to any resource which will allow me to achieve this?
I want to do this on the checkbox click event or something similar.

Marin Bratanov
Telerik team
 answered on 05 Apr 2021
10 answers
1.0K+ views

Hi,

I get an error when I click the filter button in this situation:

I have a colum with enum datatype. I filter the column on 1 of the enumeration values. After changing the filters, I save the gridstate to local storage. I use the system.text.json to serialize the gridstate. 

After refreshing the page, the filter loads correctly, the data is filtered on the database and the filter button is marked as used. When I click the button to change the filter, I get following error:

Unhandled exception in circuit '{CircuitId}'. (System.InvalidCastException: Unable to cast object of type 'System.Int16' to type 'System.Int32'.
   at Telerik.Blazor.Components.Common.Editors.TelerikEnumEditor.get_CurrentValue()
   at Telerik.Blazor.Components.Common.Editors.TelerikEnumEditor.BuildRenderTree(RenderTreeBuilder __builder)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue())

Thanks

 

Bert
Top achievements
Rank 1
Veteran
 answered on 02 Apr 2021
3 answers
1.7K+ views

Hi. I have a form that posts to a payment platform. I'd like to have a button that submits the form but also runs some other code, e.g. set a property to hide elements on the page.

 

Can I do this?   If so should I use ButtonType="ButtonType.Submit" plus an OnClick?  This doesn't seem to work.  Or should I use a ButtonType.Button and use some code to post the form?  (If so how could I do that)?

 

Thanks.

Dean

Stamo Gochev
Telerik team
 answered on 02 Apr 2021
1 answer
767 views

I am using the OnClick event of the menu to perform some actions and then navigate to the new page (using NavigationManager).

The problem I am having is that if the item I clicked on is in a drop down menu, the dropdown is still expanded after the navigation (note the menu is in the MainLayout).  

Is there anyway I can collapse the menu before (or after) it navigates?

Marin Bratanov
Telerik team
 answered on 01 Apr 2021
5 answers
632 views
Is it possible to create a custom column type (eg GridValidationColumn) for TelerikGrid?

I found the following example to validate a TelerikGrid cell (EditMode = GridEditMode.Incell).
https://feedback.telerik.com/blazor/1447439-is-there-a-way-to-implement-custom-validation-in-a-blazor-telerik-grid-when-pressing-save-update-command- button-if-not-is-there-plans-on-providing-custom-validation-as-a-feature-in-the-near-future
Starting from this example, in order not to repeat the validation code for each column, GridValidationColumn will need to have a default EditorTemplate that contains all the logic in the example. With the option to customize only the cell editor.
Marin Bratanov
Telerik team
 answered on 01 Apr 2021
3 answers
910 views
I have a grid that I added a column for a checkbox to select the row. I have multiple selection on. Now I want to respond to a button click and display the selected items in the grid. But I am finding that the act of clicking on the button deselects the selected items. How do I keep the keep the grid selection through a click on a button?
Marin Bratanov
Telerik team
 answered on 01 Apr 2021
1 answer
293 views

Hi,

I'm using the OnRead Event to do server side grouping and filtering. This is the function I use to retrieve the data:

DataSourceResult Result;
                if (_Request.Groups.Count > 0)
                {
                    argsCloned.Groups.Clear();
                    Result = await queriableData.ToDataSourceResultAsync(argsCloned);
                }
                else
                    Result = await queriableData.ToDataSourceResultAsync(_Request);


                DataEnvelope<T> dataToReturn = null;
                if (_Request.Groups.Count > 0)
                {
                    // Group again => Do grouping on local data
                    if (Result.Data != null)
                    {
                        Result = await Result.Data.ToDataSourceResultAsync(_Request);

                        dataToReturn = new DataEnvelope<T>
                        {
                            GroupedData = Result.Data.Cast<AggregateFunctionsGroup>().ToList(),
                            TotalItemCount = Result.Total
                        };
                        _GridData = dataToReturn.GroupedData.Cast<object>().ToList();
                    }
                }
                else
                {
                    dataToReturn = new DataEnvelope<T>
                    {
                        CurrentPageData = Result.Data.Cast<T>().ToList(),
                        TotalItemCount = Result.Total
                    };
                    _GridData = dataToReturn.CurrentPageData.Cast<object>().ToList();

                }

 

This works fine, the grouping is done and the aggregate data seems to be correct. But I don't see the data in the GroupFooterTemplate. If I Put a breakpoint inside the GroupFooterTemplate, the breakpoint is never hit.

<GridAggregates>    
                <GridAggregate Field="@nameof(TblCarrier.CarArtUid)" Aggregate="@GridAggregateType.Count" />
                <GridAggregate Field="@nameof(TblCarrier.CarQty)" Aggregate="@GridAggregateType.Sum" />
                <GridAggregate Field="@nameof(TblCarrier.CarWeightNetto)" Aggregate="@GridAggregateType.Sum" />
            </GridAggregates>

            <GridColumns>
                <GridColumn Field="@nameof(TblCarrier.CarUid)" FieldType="@(typeof(long))" Title="Uid" Width="150" Editable="false" Filterable="true">
                </GridColumn>

                <GridColumn Field="@nameof(TblCarrier.CarBarcode)" FieldType="@(typeof(long))" Title="Barcode" Width="150" Editable="false" Filterable="true"/>
                <GridColumn Field="@nameof(TblCarrier.CarTsCreation)" FieldType="@(typeof(DateTime))" Title="Ts Created" DisplayFormat="{0:dd/MM/yyyy HH:mm:ss.fff}" Width="200" Editable="false" Filterable="true"/>
                <GridColumn Field="@nameof(TblCarrier.CarTsLastMove)" FieldType="@(typeof(DateTime))" Title="Ts Moved" DisplayFormat="{0:dd/MM/yyyy HH:mm:ss.fff}" Width="200" Editable="false" Filterable="true"/>      
                <GridColumn Field="@nameof(TblCarrier.CarDescription)" FieldType="@(typeof(string))" Title="Description" Width="200" Editable="@(this.RoleLevel>=eRoles.Administrator)"  Filterable="true"/>
                <GridColumn Field="@nameof(TblCarrier.CarArtUid)" FieldType="@(typeof(string))" Title="Article ID" Width="200" Editable="@(this.RoleLevel>=eRoles.Developer)" Filterable="true">
                    <GroupHeaderTemplate>
                        @{
                            // you can use aggregates for other fields/columns by extracting the desired one by its
                            // field name and aggregate function from the AggregateResults collection
                            // The type of its Value is determined by the type of its field - decimal for the Salary field here
                            var ctx = context as GridGroupTemplateContext;
                            
                        }
                        Team Members: <strong>@context.Count</strong>
                    </GroupHeaderTemplate>      
                    <GroupFooterTemplate>
                        @{
                            // you can use aggregates for other fields/columns by extracting the desired one by its
                            // field name and aggregate function from the AggregateResults collection
                            // The type of its Value is determined by the type of its field - decimal for the Salary field here
                            var ctx = context as GridGroupTemplateContext;
                            
                        }
                        Team Members: <strong>@context.Count</strong>
                    </GroupFooterTemplate> 
                </GridColumn>

Best Regards

Marin Bratanov
Telerik team
 answered on 01 Apr 2021
1 answer
177 views

Hi,

I have  problem when I use aggregates on included fields in EF Core. Let me try to explain:

I have following queriable data:

 IQueryable<TblCarrier> queriableData = context.TblCarriers
                        .Include(x => x.CarPosU)
                        .Include(x => x.CarPosToNavigation)
                        .Include(x => x.CarArtU)
                        .AsQueryable();

 

The code herunder is working fine:

<GridAggregates>    
                <GridAggregate Field="CarArtUid" Aggregate="@GridAggregateType.Count" />
            </GridAggregates>

            <GridColumns>
                <GridColumn Field="CarUid" FieldType="@(typeof(long))" Title="Uid" Width="150" Editable="false" Filterable="true">
                </GridColumn>

                <GridColumn Field="CarBarcode" FieldType="@(typeof(long))" Title="Barcode" Width="150" Editable="false" Filterable="true"/>
                <GridColumn Field="CarTsCreation" FieldType="@(typeof(DateTime))" Title="Ts Created" DisplayFormat="{0:dd/MM/yyyy HH:mm:ss.fff}" Width="200" Editable="false" Filterable="true"/>
                <GridColumn Field="CarTsLastMove" FieldType="@(typeof(DateTime))" Title="Ts Moved" DisplayFormat="{0:dd/MM/yyyy HH:mm:ss.fff}" Width="200" Editable="false" Filterable="true"/>      
                <GridColumn Field="CarDescription" FieldType="@(typeof(string))" Title="Description" Width="200" Editable="@(this.RoleLevel>=eRoles.Administrator)"  Filterable="true"/>
                <GridColumn Field="CarArtUid" FieldType="@(typeof(long))" Title="Article" Width="200" Editable="@(this.RoleLevel>=eRoles.Developer)" Filterable="true">
                       <GroupHeaderTemplate>
                            Count: (@context.Count)
                        </GroupHeaderTemplate> 
                    
                    </GridColumn>

But when I try this, The context.count value is null:

<GridAggregates>    
                <GridAggregate Field="CarArtU.ArtErpCode" Aggregate="@GridAggregateType.Count" />
            </GridAggregates>

            <GridColumns>
                <GridColumn Field="CarUid" FieldType="@(typeof(long))" Title="Uid" Width="150" Editable="false" Filterable="true">
                </GridColumn>

                <GridColumn Field="CarBarcode" FieldType="@(typeof(long))" Title="Barcode" Width="150" Editable="false" Filterable="true"/>
                <GridColumn Field="CarTsCreation" FieldType="@(typeof(DateTime))" Title="Ts Created" DisplayFormat="{0:dd/MM/yyyy HH:mm:ss.fff}" Width="200" Editable="false" Filterable="true"/>
                <GridColumn Field="CarTsLastMove" FieldType="@(typeof(DateTime))" Title="Ts Moved" DisplayFormat="{0:dd/MM/yyyy HH:mm:ss.fff}" Width="200" Editable="false" Filterable="true"/>      
                <GridColumn Field="CarDescription" FieldType="@(typeof(string))" Title="Description" Width="200" Editable="@(this.RoleLevel>=eRoles.Administrator)"  Filterable="true"/>
                <GridColumn Field="CarArtU.ArtErpCode" FieldType="@(typeof(long))" Title="Article" Width="200" Editable="@(this.RoleLevel>=eRoles.Developer)" Filterable="true">
                       <GroupHeaderTemplate>
                            Count: (@context.Count)
                        </GroupHeaderTemplate> 
                    
                    </GridColumn>

 

The griddata is refreshed with the onread event

 DataEnvelope<T> dataToReturn = null;
                if (_Request.Groups.Count > 0)
                {
                    // Group again => Do grouping on local data
                    if (Result.Data != null)
                    {
                        Result = await Result.Data.ToDataSourceResultAsync(_Request);

                        dataToReturn = new DataEnvelope<T>
                        {
                            GroupedData = Result.Data.Cast<AggregateFunctionsGroup>().ToList(),
                            TotalItemCount = Result.Total
                        };
                        _GridData = dataToReturn.GroupedData.Cast<object>().ToList();
                    }
                }
                else
                {
                    dataToReturn = new DataEnvelope<T>
                    {
                        CurrentPageData = Result.Data.Cast<T>().ToList(),
                        TotalItemCount = Result.Total
                    };
                    _GridData = dataToReturn.CurrentPageData.Cast<object>().ToList();

                }

The grouped data seems to be fine. (See attached screenshot). The aggregate items key is CarArtU-ArtErpCode. Shouldn't that be CarArtU.ArtErpCode?

Thanks

 

 

 

Marin Bratanov
Telerik team
 answered on 01 Apr 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?