Question

I'm using SlickGrid, and I was wondering if there's a way for me to create a totals row on top, under the header row.

I saw that the issue was brought up here: https://github.com/mleibman/SlickGrid/issues/26

And it was implemented here: https://github.com/mleibman/SlickGrid/commit/19624f6687a0d2671639c4b1f2c05eb20c9ab0c7. (But I can't find those methods in the current version anymore!)

Also, I found a fork on this site: https://railadvisor.com/js/slickgrid/examples/example15-fork-feature-demo.html.

Could anybody tell me how to do something similar to that using the current implementation of SlickGrid? Also, I wouldn't want the totals row to be filtered. Thanks!


Edit: Here's my attempt in a jsFiddle: http://jsfiddle.net/crystality/Jwc6q/
(I copied code from these examples: Multi-column sorting and Using fixed header row for quick filters.)

Était-ce utile?

La solution

You are on the right track. All you have to do now is to calculate totals for each column and append it to the <p> (instead of the TOTAL). Also, you can subscribe to the grid.onCellChange event to update your header if your table is editable.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top