ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Grid - Footer on Deleting rows
Title:
B
I
{code}
?
I see your https://demo.aspnetawesome.com/GridCrudDemo sample I insert a footer with sum, but if i delete a row the TOT is not recalculated public IActionResult GridGetItems(GridParams g, string search) { search = (search ?? "").ToLower(); var items = Db.Dinners.Where(o => o.Name.ToLower().Contains(search)).AsQueryable(); return Json(new GridModelBuilder<Dinner>(items, g) { Key = "Id", // needed for api select, update, tree, nesting, EF MakeFooter = MakeFooter, GetItem = () => Db.Get<Dinner>(Convert.ToInt32(g.Key)), Map = MapToGridModel }.Build()); } private object MakeFooter(GroupInfo<Dinner> info) { return new { Id = "TOT = " + info.Items.Sum(o => o.Id) }; }
Save Changes
Cancel
mtugnoli
asked at 17 Oct 2018
Answers
B
I
{code}
?
when you delete a row in our demo `utils.itemDeleted` is called and that function removes the html row `tr`, what you need to do is reload the grid, so that the footer will be recalculated. you can either change `CrudHelpers.InitCrudPopupsForGrid` to use `utils.refreshGrid` instead of `itemDeleted`, or change `utils.itemDeleted` to the same as `utils.refreshGrid`
Save Changes
Cancel
Omu
answered at 17 Oct 2018
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