Hi Guys,
Will you suggest how to do rows numbering in datagrid, based on the List?
Something like this:
<RadzenLabel Text="@((addresses.Value.IndexOf(address)+1).ToString())" Placeholder="LP"/>
Hi Guys,
Will you suggest how to do rows numbering in datagrid, based on the List?
Something like this:
<RadzenLabel Text="@((addresses.Value.IndexOf(address)+1).ToString())" Placeholder="LP"/>
The problem is that each row has the number of the clicked row .
Of course, I would like to receive successively numbered rows (1,2,3....).
<StatusBarComponent StatusBar="statusBar"></StatusBarComponent>
<RadzenGrid @ref="addressGrid" AllowFiltering="true" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
AllowPaging="true" PageSize="40" AllowSorting="true" Data="@addresses.Value" TItem="Address" RowSelect="@(args => address = args)" RowDoubleClick="@UpdateAddressByModal" RowUpdate="@OnUpdateRowAsync" ColumnWidth="100%">
<Columns>
<RadzenGridColumn TItem="Address" Title="Lp">
<Template>
<RadzenLabel Text="@((addresses.Value.IndexOf(address) + 1).ToString())" Placeholder="LP"/>
</Template>
</RadzenGridColumn>
...
You should use context
to access current data item in the DataGrid column Template.
Thank You
<RadzenGridColumn TItem="Address" Title="Lp">
<Template Context="address" >
<RadzenLabel Text="@((addresses.Value.IndexOf(address) + 1).ToString())" Placeholder="LP"/>
</Template>
</RadzenGridColumn>
How can i display a row number which is not dependent on the data i.e i want to see 1,2,3,4,5,6 because if it depends on the data it gets all messed up(out of order) when you sort by a column,
Hi
what is type of addresses?
And the fact that I use "RadzenDataList" doesn't make a difference?
How to code this in the Radzen designer?
the context is "data" and Grid Data value = "@Beheereenheden"
this gives me an error :
The annotation for nullable reference types should only be used in code within a '#nullable' annotations context
${}
expression will automatically name data
using proper context name.
Data source method to get the Data for the datagrid returns a IEnumerable type , so getting the index of the record with IndexOf() was pointless.
However if converting the type to a List with ToList() gives the desired outcome.
Iād question the wisdom of this but this will do for now.
Thank you for your input with the ${} , I was assuming that the datatype in this post was returned from a generated data source method.
Final code that worked:
result:
Is there a solution in the meantime? I dont need the index of the property in my data list, I need an independent row number which doesn't change by filtering or sorting the data.