Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

How do i show totals in Model admin?


Go to End


1315 Views

Avatar
Optic Blaze

Community Member, 190 Posts

6 March 2016 at 3:06am

Hi there,

I have a dataobject called Sizes that stores the width and height of an object. I want to be able to show the square meters as a total in model admin, How do i do that:


class Sizes extends DataObject {
	
	static $db = array(
	'Width'=>'Decimal',
	'Height'=> 'Decimal',
	);

And in model admin i have

class SizesAdmin extends ModelAdmin {
  static $managed_models = array('Sizes'); 
  static $url_segment = 'sizes'; 
  static $menu_title = 'Sizes';