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.
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
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
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?
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
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
Hi,
Does someone know if it is possible to extract the HTML code from the grid component?
My goal is to investigate if there is a way of importing a grid into the editor component.
Much appreciated any thoughts.
Cheers
Hi,
Does anyone know if it is possible to insert a grid component (that is currently rendered on screen) into the editor?
My thoughts are that it should be possible to "convert" the grid into HTML code using the table tags.
Appreciate any thoughts or advice.
Cheers