Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
146243 | Jul 28,2019 08:38 AM UTC | Aug 5,2019 09:52 AM UTC | Blazor | 3 |
![]() |
Tags: Grid |
<EjsGrid @ref="@grid" AllowPaging="true" OnActionBegin="OnBegin" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel", "ColumnChooser"})" OnBatchDelete="onDelete" RowDataBound="RowBound" DataSource="@data">
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Batch"></GridEditSettings>
<GridColumns>
<GridColumn Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true" Width="90"></GridColumn>
<GridColumn Field="CustomerID" HeaderText="Customer ID" Width="90"></GridColumn>
<GridColumn Field="Freight" HeaderText="Freight" Width="90"></GridColumn>
<GridColumn Field="Cal" HeaderText="Freight" Width="90"></GridColumn>
</GridColumns>
</EjsGrid>
@functions{
public bool flag = false;
public double Count = 1;
public double currentpage = 1;
List<Orders> data;
EjsGrid grid;
public List<Orders> order = new List<Orders>();
public void onDelete(BeforeBatchDeleteArgs args)
{
flag = true;
}
public void OnBegin(ActionEventArgs args)
{
if (args.RequestType.ToString() == "Paging")
{
currentpage = args.CurrentPage;
Count = ((currentpage - 1) * 12) + 1;
}
}
public void RowBound(RowDataBoundEventArgs args)
{
var Data = JsonConvert.DeserializeObject<Orders>(JsonConvert.SerializeObject(args.Data));
if (flag)
{
Count =((currentpage - 1) * 12) + 1;
flag = false;
}
grid.SetCellValue(Data.OrderID, "Cal", Count);
Count++;
}
protected override void OnInit()
{
BindDataSource();
this.data = order;
}
} |
Component name + Events
Component name + Events
”
<EjsGrid id="Grid" TValue="RowType" Height="300px" AllowPaging="true" DataSource="Data" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })">
<GridEvents RowDataBound="OnData" TValue="RowType" OnBatchDelete="OnDelete" OnActionBegin="OnBegin"></GridEvents>
……………………………………………….
</EjsGrid> |
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.