ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
create footer in grid with client data
Title:
B
I
{code}
?
How we can create footer summary (like show max or sum or min of columns) in grid that uses client data ?
Save Changes
Cancel
Esmaeil Tallan
asked at 21 Apr 2016
Answers
B
I
{code}
?
here's an example with header and footer summary: @(Html.Awe().Grid("GridClientDataSum") .DataFunc("getGridDataSum") .Height(350) .Mod(o => o.PageInfo().PageSize().ColumnsSelector()) .Persistence(Persistence.View) .Columns( new Column { Bind = "Id", Width = 75, Groupable = false, Resizable = false }, new Column { Bind = "Person" }, new Column { Bind = "Food" }, new Column { Bind = "Location" }, new Column { Bind = "Price", Width = 120 }, new Column { Bind = "Country.Name", ClientFormat = ".CountryName", Header = "Country" }, new Column { Bind = "Chef.FirstName,Chef.LastName", ClientFormat = ".ChefName", Header = "Chef" })) <script> function getGridDataSum(gp) { var g = utils.getGridParams(gp); function map(o) { return { Id: o.Id, Person: o.Person, Food: o.Food, Location: o.Location, Price: o.Price, CountryName: o.Country.Name, ChefName: o.Chef.FirstName + ' ' + o.Chef.LastName }; }; function makeFooter(info) { var priceSum = 0; $.each(info.Items, function(_, el) { priceSum += el.Price; }); return { Food: " count = " + info.Items.length, Price: priceSum }; } function makeHeader(gr) { var name = gr.Items[0][gr.Column]; return { Content: name + ' Count = ' + gr.Items.length }; } return utils.gridModelBuilder(this, g, lunches, { key:"Id", map:map, dates:["Date"], makeFooter:makeFooter, makeHeader: makeHeader }); } </script>
Save Changes
Cancel
Omu
answered at 23 Apr 2016
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK