Hello,
I work on a Grid and use .Aggregate() and .CellAction() (for cell.HtmlAttributes["style"]).
Everything works except when I rebind the grid on the client-side (after edit, delete, etc.). I lost my aggregations and all my cells style too. How can I keep this parameters during a rebind ?
Here is my grid :
Thank in advance for your help,
Alexandre G.
I work on a Grid and use .Aggregate() and .CellAction() (for cell.HtmlAttributes["style"]).
Everything works except when I rebind the grid on the client-side (after edit, delete, etc.). I lost my aggregations and all my cells style too. How can I keep this parameters during a rebind ?
Here is my grid :
@{
Html.Telerik().Grid(Model)
.Name(
"Grid"
)
.DataBinding(dataBinding =>
{
dataBinding.Ajax()
.Select(
"Select"
,
"MyController"
)
.Insert(
"Insert"
,
"MyController"
)
.Update(
"Update"
,
"MyController"
)
.Delete(
"Delete"
,
"MyController"
);
})
.ClientEvents(events => events
.OnDataBinding(
"onDataBinding"
)
.OnComplete(
"onComplete"
)
.OnEdit(
"onEdit"
)
.OnRowDataBound(
"onRowDataBound"
))
.Columns(columns =>
{
columns.Command(commands =>
{
commands.Edit().ButtonType(GridButtonType.Image);
commands.Delete().ButtonType(GridButtonType.Image);
}).Width(30); ;
columns.Bound(o => o.Id);
columns.Bound(o => o.col1);
.Aggregate(aggregates => aggregates.Sum())
.GroupFooterTemplate(@<text>@item.Sum</text>);
columns.Bound(o => o.col2)
.Aggregate(aggregates => aggregates.Sum())
.GroupFooterTemplate(@<text>@item.Sum</text>);
columns.Bound(o => o.col3)
.Aggregate(aggregates => aggregates.Sum())
.GroupFooterTemplate(@<text>@item.Sum</text>);
})
.CellAction(cell =>
{
if
((cell.Column.Member ==
"col1"
)
{
cell.HtmlAttributes[
"style"
] =
"background-color: red"
;
}
})
.Sortable(sorting => sorting
.SortMode(GridSortMode.MultipleColumn)
)
.Filterable()
.Render();
}
}
Thank in advance for your help,
Alexandre G.