<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> |
|