public function addGrandTotals($fields = UNDEFINED)
    {
        if (!$this->getIterator() instanceof SQL_Model) {
            throw $this->exception('Grand Totals can be used only with SQL_Model data source');
        }

        return $this->_addTotals($fields, 'onRequest');
    }
public function addGrandTotals($fields = UNDEFINED)
    {
        if (!$this->getIterator() instanceof SQL_Model) {
            throw $this->exception('Grand Totals can be used only with SQL_Model data source');
        }

        return $this->_addTotals($fields, 'onRequest');
    }
public function addGrandTotals ( $ fields = UNDEFINED ) { if ( ! $ this -> getIterator ( ) instanceof SQL_Model ) { throw $ this -> exception ( 'Grand Totals can be used only with SQL_Model data source' ) ; } return $ this -> _addTotals ( $ fields , 'onRequest' ) ; }
Enable totals calculation for specified array of fields.

If particular fields not specified, then all field totals are calculated.
If you only need to count records, then pass null and no fields will be calculated.

Be aware that this method works ONLY for SQL models set as data source
because this calculates grand totals using DSQL.

@param array $fields optional array of fieldnames

@return $this
Enable totals calculation for specified array of fields .