I read from a few forums that eexcelview can be used to export the table grid to excel. Can anyone tell me how it can work if we filter the table and then export only the filtered results?i can do the normal one(i.e. export full grid data) but cant get the filtered data to be exported to excel…
Could you tell me how to do an export here?have included the extension…how should my export button be?
presently its as follows
echo CHtml::button('Export To Excel', array('submit' => array('TblBasicEmployeeDetails/export'),'YII_CSRF_TOKEN' => Yii::app()->request->csrfToken
));
public function actionExport()
{
$model=new TblBasicEmployeeDetails;
/* $bh = Yii::createComponent(array(
'class'=>'ext.eexcelview.EExcelBehavior',
));
$this->attachBehavior('excelExport',$bh);
$this->toExcel($model->search(),
array(
'emp_code',
'user_code',
'first_name',
'employee_full_name',
'designation.designation_name::Designation',
'department.department_name::Department',
'process.process_name::Process',
'location.location_name::Location',
'doj::Date of Joining',
'email_address',
'manager.employee_full_name::Manager',
'shiftManager.employee_full_name::Shift Manager'
),
'Employee Details',
array(
'creator' => 'CCC Admin',
),
'Excel5' // This is the default value, so you can omit it. You can export to CSV, PDF or HTML too
);
//thus we can keep the modify in a method ! */
}
how do i change the controller action code i.e. actionExport?
thanks for helping me i got it using the search() itself…now only to change the id’s to names…i mean the foreign keys to be converted to their name…i will check it now…
I have a problem with my EExcelView export result.
I have a field with a default value (it is filled by its value if it’s left empty).
I don’t know why, only the row that contain this default value can appear (not with other row).
I tried to view result in grid, and i found that the filter is not working. Also, in the filter box of the field with default value, it is filled by its default value (maybe this is why only the row that contain this default value can appear). But it is cannot be change.
I don’t know what happen actually, besides in the first time it can work properly.
The attribute is being set to the default value in your filter object when you instantiate it. To get around that, after creating the filter object but before assigning values from the GET array, try setting the value of the defaulting attribute to null.