Hello,
I want to set the value of a tool tip based on a value of an item in my grid. I have tried this, but I get an error:
This is above all HTML taken from an example
<TelerikTooltip TargetSelector=".tooltip-target">
</TelerikTooltip>
<GridColumn Editable=false Locked=true Visible="@isIDVisible" Field=@nameof(ProductDto.ProductId) Title="ID" Width="150px">
<Template>
@{
var item = (ProductDto)context;
}
<TelerikButton ThemeColor="success" OnClick="() => SetAmtToAnotherCol(item)">Test</TelerikButton>
<br />
<TelerikButton FillMode="link" ThemeColor="info" Class="tooltip-target"
Title="(@item.UnitsInStock < 0) ? 'neg' : 'pos'"
OnClick="() => SetAmtToAnotherCol(item)">@item.UnitsInStock</TelerikButton>
</Template>
</GridColumn>
I receive this error:
RZ9986 | Component attributes do not support complex content (mixed C# and markup). Attribute: 'Title', text: '(item.UnitsInStock < 0) ? 'neg' : 'pos''
|
If I simply do this, it works:
Title=@item.UnitsInStock.ToString()
Is there a way for me to set a string based on a value?
Hello,
Now the TelerikTreeList component is rendered by default with the css class k-grid-md.
On the TelerikGrid component the Size can be set so the grid can be rendered with the css class k-grid-sm.
I would need the possibility to set on TelerikTreeList component the css class k-grid-sm.
How can that be achieved now?
Best regards,
Cipri
Like I mentioned in the subject a needs an Excel-Export that exports only the selected items/rows.
I found this article:
and it works fine. But it works only with the build in GridCommandButton. I need a programmatic Export like described in article
Any help ?
I would like to add a UI component that displays the current list of items that are selected in a multi-select listbox. As selections and deselections are made inside of the list box, those selections are also displayed or removed on a separate part of the page that is visible to the user.
Is there a demo available that shows doing something like this or is there a control that already implements this capability?
Thanks,
T
I am trying to show some grid-aggregates in a grid column footer without any groups. But I'm seeing that the grid is geting ALL the records in the database to compute the Agregates. I am using the OnRead event and a DbSet with the ToDataSourceResult() extension method.
This is unnacceptable as I have 50k rows in the DB! As you can imagine the aggregates take forever to compute in-memory, but in the DB it woul be a super quick.
Also, I am building a generic grid for all my pages, so I need it to be easy to abstract, FYI
Any alternatives or workarounds? Could we not build a ExpressionTree for the aggregates and use IQueriable?
Thanks in advance!
...
<GridColumns>
<GridColumn Field="@nameof(PedidosDeClientes.Unidades)" Title="Unidades" Width="150px">
<FooterTemplate>
Sum: @context.Sum;
</FooterTemplate>
</GridColumn>
<GridColumn Field="@nameof(PedidosDeClientes.PesoBruto)" Title="PesoBruto" Width="150px">
<FooterTemplate>
Sum: @context.Sum;
</FooterTemplate>
</GridColumn>
</GridColumns>
<GridAggregates>
<GridAggregate Field=@nameof(PedidosDeClientes.Unidades) Aggregate="@GridAggregateType.Sum" />
<GridAggregate Field=@nameof(PedidosDeClientes.PesoBruto) Aggregate="@GridAggregateType.Sum" />
</GridAggregates>
...
public async Task OnRead( GridReadEventArgs args )
{
var r = await dbContext.PedidosDeClientes.ToDataSourceResultAsync( args.Request );
args.Data = r.Data;
args.Total = r.Total;
args.AggregateResults = r.AggregateResults;
}
Hi,
I'm looking to subscribe to scrolling events in the data grid using JavaScript.
I've tried subscribing to the scroll event on the .k-grid and .k-grid-content elements, but the events don't happen
Is there a way to do this?
Thanks,
Oliver
Hello,
I got a new project going on, which includes unique design.
I am using Telerik grid for Blazor for functionality but trying to change the contents look.
I have managed to change the header row style like you can see above with the following code:
.k-grid-header-wrap{
border-radius:15px;
margin-block:5px;
}
but the inside rows don't response to the CSS lines (except the background):
.k-master-row, .k-table-alt-row{
margin-block:15px;
background:#fff!important;
border-radius:15px!important;
}
So the question is - is it possible to add margin between the girds lines and furthermore add more style properties (specific to the grids content)? and if yes, could someone please provide an example for this?
thanks ahead,
Michael.
It does not put double quotes around the value, there by messsing up the structure.
Is there a way to get the grid exporter to Put double quotes around string values?
Hi,
I am using telerikgrid control to display the employees information. I have telerikgridcheckboxcolumn which is bind to a IEnumerable list of employee who are eligible for promotion.
I am looking for a solution to disable this header checkbox when there is none of the employee is eligible for promotion.
Please see below my code snippet for Grid and Checkbox:
<TelerikGrid Data="ShipmentInfo" SelectionMode="GridSelectionMode.Multiple" SelectedItems="SelectedEmployees" Class="grid-no-scroll" Sortable="true" Size="Telerik.Blazor.ThemeConstants.Grid.Size.Medium" Resizable="true" Pageable="false" Height="55vh" ScrollMode="GridScrollMode.Scrollable" FilterMode="GridFilterMode.None" OnRowRender="@OnRowRenderHandler" SelectedItemsChanged="@((IEnumerable<EmployeeInfoDto> employeess) => SelectedItemsChanged(employees))">
<GridCheckboxColumn Title="Allow Promotion" SelectAll="true" CheckBoxOnlySelection="true" HeaderClass="@GetHeaderCssClass()"></GridCheckboxColumn>
private void SelectedItemsChanged(IEnumerable<EmployeeInfoDto> employees)
{
// Checkboxes are disabled for shipments that aren't allowed to be routed but we don't want the select all function to select unroutable shipments
// so remove any unroutable shipments from the given collection and set that to the SelectedItems collection
SelectedEmployees = employeess.Where(s => s.EligibleForPromotion).ToList();
}
Please can you help get my desired requirement.
Thanks & regards,
Afreen
I have a grid that lists some records that have a column called Status. The initial state of the grid does not include any records with a status of "Finished" but I want to allow the user to remove that filter as they need to.
When I use the code below it does not allow me to set a default filter in the grid which can be removed by the end user.
private async Task OnStateInitHandler(GridStateEventArgs<FlagVM> args)
{
var cfd = new CompositeFilterDescriptor()
{
FilterDescriptors = new FilterDescriptorCollection()
{
new FilterDescriptor() { Member = "Status/Name", Operator = FilterOperator.DoesNotContain, Value = "Finished", MemberType = typeof(string) }
},
LogicalOperator = FilterCompositionLogicalOperator.And
};
var state = new GridState<FlagVM>
{
FilterDescriptors = new List<IFilterDescriptor>() {}
};
state.FilterDescriptors.Add(cfd);
args.GridState = state;
}
I've also tried something like this with no luck. I basically want to set the UI filter to an initial state for the user.
protected async Task SetGridDefaultFilter()
{
GridState<FlagVM> desiredState = new()
{
FilterDescriptors = new List<IFilterDescriptor>()
{
new CompositeFilterDescriptor(){
FilterDescriptors = new FilterDescriptorCollection()
{
new FilterDescriptor() { Member = "Status/Name", Operator = FilterOperator.DoesNotContain, Value = "Approved", MemberType = typeof(string) }
},
LogicalOperator= FilterCompositionLogicalOperator.And
}
}
};
await GridRef.SetState(desiredState);