I have a grid and I want to calculate the column. Here is the code I have to calculate the total column
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.ProductId).Groupable(false);
columns.Bound(p => p.ProductName);
columns.Bound(p => p.UnitPrice);
columns.Bound(p => p.Quantity);
columns.Bound(p => p.Tax);
columns.Bound(p => p.Total).ClientTemplate("#= calculate() #");
})
.Groupable()
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.Editable(e=>e.Mode(GridEditMode.InCell))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Products_Read", "Product"))
.PageSize(20)
.Model(model =>
{
model.Id(p => p.ProductId);
model.Field(p => p.ProductName);
model.Field(p => p.UnitPrice);
model.Field(p => p.Quantity);
model.Field(p => p.Tax);
})
))
I want to calculate the last column.
您可以尝试使用以下模板:):
#= UnitPrice*Tax #
如果要在运行时进行计算,请处理“网格变化”事件并在此处使用解决方案: Kendo Asp.net MVC网格批处理模式“计算列”显示不会更新
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.