-1

I'm using the extend from Yiiboster (last version)

and I want to add a Total to an invoice and I want to do a TbSumOperation but without success so far

I don't know how to specify from which column on columns to sum

So far I only get a blank rectangle

I just copy pasted the example from the page and put it after columns=>(),

   'extendedSummary' => array(
        'title' => 'Total Employee Hours',
        'columns' => array(
            'hours' => array('label'=>'Total Hours', 'class'=>'TbSumOperation')
        )
    ),
    'extendedSummaryOptions' => array(
        'class' => 'well pull-right',
        'style' => 'width:300px'
    ),

Can anyone help?

4

1 回答 1

0

您必须从您的 init 方法中查看这一行

'dataProvider' => $gridDataProvider,

这是您查询并绑定到网格中的结果,您想要求和的列名应该放在`extendedSummary.

示例:我想汇总我的员工的工作时间。我的员工表有hours这样的列

emp_id|name     |hours

1      Kevin     48    
2      Denton    16    
3      Harry     30

.

$gridDataProvider = new CActiveDataProvider('EmployeeModel', array(
                    'criteria' => array('condition' => 'age > 20')));

而且我应该将hours字符串放入我的网格摘要设置中

于 2013-08-20T03:57:38.043 回答