@Html.EJS().Grid("FlatGrid").DataSource((IEnumerable<object>)ViewBag.dataSource).QueryCellInfo("querycellinfo").Columns(col =>
{
col.HeaderText("Row Numer").Width("90").Add();
col.Field("EmployeeID").HeaderText("Employee ID").IsPrimaryKey(true).Width("120").Add();
col.Field("CustomerID").HeaderText("Customer Name").Width("150").Add();
col.Field("OrderDate").HeaderText("Order Date").Type("date").Width("110").Add();
col.Field("Freight").HeaderText("Freight").EditType("numericedit").Width("120").Add();
col.Field("ShipCountry").HeaderText("Ship Country").Width("150").Add();
}).AllowPaging().Render()
<script>
var count = 1;
function querycellinfo(args) {
if (args.column.headerText == "Row Numer") {
args.cell.innerHTML = count;
count++;
}
}
</script>
|