Please help me with the TagHelper equivalent of the following code.
ps. A suggestion for your documentation team; please include more useful examples like you have for the razor code -> the one read-only example is trivial and on the border of being useless.
@(Html.Kendo().Grid<
OrderViewModel
>
()
.Name("grid2")
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Width(100);
columns.Bound(p => p.Freight);
columns.Bound(p => p.OrderDate).Format("{0:yyyy-MM-dd HH:mm:ss}");
columns.Bound(p => p.ShipName);
columns.Bound(p => p.ShipCity);
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(250);
})
.ToolBar(toolbar => toolbar.Search())
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Pageable()
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.PageSize(80)
//.Events(events => events.Error("error_handler"))
.Model(model => model.Id(p => p.OrderID))
.Read(read => read.Action("Orders_Read", "Grid"))
.Create(create => create.Action("Orders_Create","Grid"))
.Destroy(update => update.Action("Orders_Destroy", "Grid"))
.Update(update => update.Action("Orders_Update", "Grid"))
)
)
I have tried with the following but have not succeeded in getting the destroy event to fire properly.
<
kendo-grid
name
=
"grid1"
height
=
"550"
>
<
columns
>
<
column
field
=
"OrderID"
title
=
"Order ID"
>
<
filterable
enabled
=
"false"
></
filterable
>
</
column
>
<
column
field
=
"Freight"
title
=
"Freight"
/>
<
column
field
=
"OrderDate"
title
=
"Order Date"
format
=
"{0:MM/dd/yyyy}"
/>
<
column
field
=
"ShipName"
title
=
"Ship Name"
/>
<
column
field
=
"ShipCity"
title
=
"Ship City"
/>
<
column
>
<
commands
>
<
column-command
text
=
"Delete"
name
=
"destroy"
></
column-command
>
<
column-command
text
=
"Edit"
name
=
"edit"
></
column-command
>
</
commands
>
</
column
>
</
columns
>
<
scrollable
enabled
=
"true"
/>
<
sortable
enabled
=
"true"
/>
<
pageable
enabled
=
"true"
/>
<
editable
mode
=
"inline"
/>
<
filterable
enabled
=
"true"
/>
<
datasource
type
=
"DataSourceTagHelperType.Ajax"
page-size
=
"20"
server-operation
=
"false"
>
<
transport
>
<
read
url
=
"@Url.Action("
Orders_Read", "Grid")" />
<
destroy
url
=
"@Url.Action("
Orders_Destroy", "Grid")" />
</
transport
>
<
schema
>
<
model
>
<
fields
>
<
field
name
=
"OrderId"
type
=
"int"
></
field
>
<
field
name
=
"Freight"
type
=
"decimal"
></
field
>
<
field
name
=
"OrderDate"
type
=
"DateTime"
></
field
>
<
field
name
=
"ShipName"
type
=
"string"
></
field
>
<
field
name
=
"ShipCity"
type
=
"string"
></
field
>
</
fields
>
</
model
>
</
schema
>
</
datasource
>
</
kendo-grid
>