|
<SfButton OnClick="Click">Selected Row Index</SfButton>
<SfGrid @ref="GridInstance" ... AllowPaging="true" Height="200"...>
...
</SfGrid>
public SfGrid<Account> GridInstance;
...
public async Task Click()
{
var CurrentSelectedRowIndex = await GridInstance.GetSelectedRowIndexes();
}
|
|
<GridColumn Field="@nameof(Account.AccountId)" IsPrimaryKey="true">
<Template>
@{
var a = (context as Account);
<div>Serial No : @RowCountAI ; Value : @a.AccountId </div>
RowCountAI++;
}
</Template>
</GridColumn>
<GridColumn Field="@nameof(Account.AccountName)" HeaderText="Account Name" TextAlign="TextAlign.Left">
<Template>
@{
var a = (context as Account);
<div>Serial No : @RowCountAN ; Value : @a.AccountName </div >
RowCountAN++;
}
</Template>
</GridColumn>
@code{
...
public int RowCountAI = 0;
public int RowCountAN = 0;
...
}
|
public void OnActionComplete(ActionEventArgs<Account> args)
{
if (args.RequestType.ToString() == "Add" || args.RequestType.ToString() == "Delete" || args.RequestType.ToString() == "BeginEdit" || args.RequestType.ToString() == "Save")
{
RowCountAI = 0;
RowCountAN = 0;
}
}
|
|
<Template>
@{
var a = (context as Account);
@if (!flag)
{
<div>Serial No : @RowCountAI ; Value : @a.AccountId </div>
RowCountAI++;
}
}
</Template>
|
Hi, I have the same requirement to have a column that displays a row number.
But, following these suggestions I am unable to get a satisfactory result.
I have a a situation that I am struggling to over come.
For my situation, I am using a Grid with a sub grid that has 'checkbox selection.
Using the approach of having work arounds to get an acceptable result.
Using work arounds, I have to update the row number column just about all the time.
Hi steve ,
We seems that you have already created the same query in another thread. For
further follow-up, please continue on that forum link
Add a column with the row number | Blazor Forums | Syncfusion®
Regards,
Prathap S