Get KoolPHP UI with 30% OFF!

Sum of a Column in the footer

Gerd Huber
Hallo,
how can i get this, i found no example.
Thanks for Information
Gerd
Posted Feb 23, 2016 Kool
Anthony Amolochitis
I've done it before, but it's been a while.
I used a numeric column type object, and then used the sum property of it to display sum at the bottom.
You may need to post a support ticket for that one
Posted Feb 23, 2016 Kool
Haluk
"getFooterText" is what you need.
-------------
<script type="text/javacript">
function foo()
{
var _mastertable = grid.getMasterTable();
var _columns = _mastertable.getColumns();
var _first_column = _columns[0];
alert(_first_column.getFooterText());
}
</script>
Posted Feb 29, 2016 Kool
Anthony Amolochitis
On the client side, that will work. There is a footerText property on the column on the server side as well. I believe you may set the value there if you would like the footer to display a sum, average, median, etc...
Posted Feb 29, 2016 , edited Feb 29, 2016 Kool
Gerd Huber
Thank you for your reply.
is there a docu, or an example.
Gerd
Posted Mar 1, 2016 Kool
Anthony Amolochitis
It's in the documentation. Footer text can be set to what you would like it to be.
Here's the google search I did to find what I wanted from the site : set footer text site:koolphp.net
http://doc.koolphp.net/Controls/KoolGrid/PHP/GridColumn/index.php#FooterText
http://doc.koolphp.net/Controls/KoolGrid/Javascript/GridColumn/index.php#setFooterText
Basically, you need to sum the values being displayed. You may need to write a javascript method to loop through the rows and compute a sum, average, median, etc..., on the grid load event.
Posted Mar 1, 2016 Kool
Igor
Hi,
you can try like this:
$column = new GridNumberColumn();
$column->DataField = "Y_2016";
$column->HeaderText = "Y_16";
$column->NullDisplayText = "N/A";
$column->FooterText = "Total Sum2016: ";
$column->Aggregate = "Sum";

$column->DecimalNumber = 0;
$column->ThousandSeperate = "."; // Display 1'000.53 instead of 1,000.53
$grid->MasterTable->AddColumn($column);
works perfect with grouping & sorting, sums in footer will be automatically calculated every time you group/sort.
Cheers,
Igor
Posted Jun 16, 2017 , edited Jul 2, 2017 Kool
Alex
Γεια, η επίλυση τεχνικών ζητημάτων στον κώδικα και η διαχείριση συναρτήσεων JavaScript απαιτεί απόλυτη συγκέντρωση, οπότε συχνά χρειάζομαι ένα διάλειμμα. Ανακάλυψα το vegashero πρόσφατα και στην αρχή δεν είχα τύχη. Μόλις ρίσκαρα λίγο, ήρθε μια μεγάλη νίκη. Στην Ελλάδα οι παίκτες βρίσκουν μοναδικά δώρα εκεί. Είναι ο καλύτερος τρόπος να χαλαρώσεις μετά την αναζήτηση λύσεων για το footerText και το masterTable.
Posted Jan 14 Kool