contributte / datagrid

:muscle: DataGrid for Nette Framework: filtering, sorting, pagination, tree view, table view, translator, etc
https://contributte.org/packages/contributte/datagrid/
MIT License
292 stars 195 forks source link

Wish: support for IAggregatable for NextrasDataSource #963

Closed milsorm closed 3 years ago

milsorm commented 3 years ago

Is it possible to add support for IAggregatable also for NextrasDataSource? I am using Nextras ORM with this datagrid and that implementation (which looks like one function only) is missing.

Thanks a lot in advance.

milsorm commented 3 years ago

NextrasDataSource.php:

    /**
     * @param  IAggregationFunction $function
     * @return void
     */
     public function processAggregation(IAggregationFunction $function): void
     {
         $function->processDataSource(clone $this->dataSource);
     }

FunctionSum.php::processDataSource at the end new style:

        if ( $dataSource instanceof DbalCollection) {
            foreach( $dataSource->fetchAll() as $item )
                $this->result += $item->getValue( $this->column );
        }
paveljanda commented 3 years ago

It looks like you know what you're doing - could you prepare a PR?

milsorm commented 3 years ago

Prepared #968