gustavnavar / Grid.Blazor

Grid component with CRUD for Blazor (client-side and server-side) and ASP.NET Core MVC
GNU Lesser General Public License v2.1
696 stars 134 forks source link

Totals rounding #386

Closed eXicRa closed 1 year ago

eXicRa commented 1 year ago

Is it possible to round the totals? So I could round the totals I calculated but not the predefined "Sum" and "Average". If I disable the predefined one, I got a null exception for e.g. SumValue.

So it would be nice to disable only the predefined totals from displaying, than I could easily calculate I want and round myself.

.Calculate("Sum", x => Math.Round(c.Get("TestCol").SumValue.Number.Value,2))

image

gustavnavar commented 1 year ago

You can use format for a column. For example:

c.Add(o => o.Freight)
    .Format("{0:#,##0.000}")
    .Sum(true).Average(true);

The format will apply to all column values, including the totals.

eXicRa commented 1 year ago

Thanks a lot, this helped me. Great work with this component.