<Syncfusion.Blazor.Buttons.SfButton OnClick="OnClick">Select Row of index 15</Syncfusion.Blazor.Buttons.SfButton>
<SfGrid @ref="Grid" DataSource="@Orders" EnableHover=false AllowSelection=true Height="280" Toolbar="@(new List<string>() { "Add"})">
...
</SfGrid>
@code {
SfGrid<Order> Grid;
public async Task OnClick()
{
await Grid.SelectRow(15);
JSRuntime.InvokeAsync<object>("scroll", 15); //here 15 is the row index to be selected
}
...
}
[scroll.js] |
<Syncfusion.Blazor.Buttons.SfButton OnClick="OnClick">Select Row of index 15</Syncfusion.Blazor.Buttons.SfButton>
<SfGrid @ref="Grid" DataSource="@Orders" EnableHover=false AllowSelection=true Height="280" Toolbar="@(new List<string>() { "Add"})">
<GridEvents TValue="Order" RowDataBound="RowBound"></GridEvents>
...
</SfGrid>
<style>
.disablerow {
opacity: .5;
pointer-events: none;
-ms-touch-action: none;
touch-action: none;
cursor: no-drop;
}
</style>
@code {
...
public void RowBound(RowDataBoundEventArgs<Order> args)
{
if (args.Data.Freight < 5)
{
args.Row.AddClass(new string[] { "disablerow" });
}
}
}
|
public void RowBound(RowDataBoundEventArgs<Order> args)
{
if (args.Data.Freight < 5)
{
args.Row.AddClass(new string[] { "disablerow" });
}
}
public void RowSelecting(RowSelectingEventArgs<Order> args)
{ {
args.Cancel = true;
}
}
|