我在页面中列出了2个表格。对于每个表,我们可以生成PDF。它对我来说很好但是当我点击第二张表的PDF然后它显示第一张表的数据而不是第二张表的数据我该如何解决这个问题,左下面是我的代码
First Table视图代码: -
<div class="span-24">
<div style="width: 100%; height: 2px; background: #999999; margin-top: 5px;" ></div>
<div class="span-24" style="margin-top: 5px">
<span id="yw4" class="actionstab" style="float:left;"> <a class="create" href="#" id="going"><?php echo Yii::t('app','View On Going Project')?></a> </span>
<span id="yw4" class="actionstab" style="float:left"> <a class="create" href="#" id="compeleted"><?php echo Yii::t('app','View Compeleted Project')?></a> </span>
<span id="yw4" class="actionstab" style="float:left"> <a class="create" href="#" id="pending"><?php echo Yii::t('app','View Pending Project')?></a> </span>
<span id="yw4" class="actionstab" style="float:left;border: none"> <a class="create" href="#" id="canceled"><?php echo Yii::t('app','View Canceled Project')?></a> </span>
<?php
$this->widget('ActionsWidget', array(
'data' => $model,
'template' => '{create}',
//'createButtonUrl' => 'array("procurement/create","id" => '.$id.')',
'createButtonVisible' => 'Yii::app()->user->checkAccess("createProject")',
'createButtonLabel' => Yii::t('app','New Project')
));
?>
</div>
<div class="span-24">
<?php
$this->beginWidget('CActiveForm', array(
'id' => 'project-form',
'enableAjaxValidation' => false,
));
$this->widget('ext.EExcelView', array(
'id' => 'project-grid',
'title' => 'Export Project ' . date('Ymd'),
'filename' => 'Export Project ' . date('Ymd'),
'selectableRows' => 2,
'dataProvider' => $model->latestProject(),
'afterAjaxUpdate' => "function(id, data){
jQuery('#Project_start_date_1').datepicker({'altField':'#Project_start_date','altFormat':'yy-mm-dd','dateFormat':'dd/mm/yy'});
jQuery('#Project_end_date_1').datepicker({'altField':'#Project_end_date','altFormat':'yy-mm-dd','dateFormat':'dd/mm/yy'});
jQuery('#Project_status').multiselect({
selectedList: 2
});
}",
'filter' => $model,
'afterAjaxUpdate' => "function(id, data){
jQuery('#Project_start_date_1').datepicker({'altField':'#Project_start_date','altFormat':'yy-mm-dd','dateFormat':'dd/mm/yy'});
jQuery('#Project_end_date_1').datepicker({'altField':'#Project_end_date','altFormat':'yy-mm-dd','dateFormat':'dd/mm/yy'});
}",
'columns' => array(
'project_no',
array(
'name' => 'name',
'type' => 'html',
'value' => function($data) {
return CHtml::link($data->name, array('project/view', 'id' => $data->id));
}
),
array(
'name' => 'scope_of_project',
'type' => 'html',
'value' => '$data->scope_of_project',
'visible'=>Yii::app()->params['project']['scope_of_project'],
),
array(
'name' => 'inspector_id',
'type' => 'html',
'filter' => $model->getInspectorList(),
'value' => function($data)
{
return $data->inspector->name." ".$data->inspector->surname;
},
'visible'=>Yii::app()->params['project']['inspector_id'],
),
array(
'class' => 'ext.myGridView.MyButtonColumn',
'buttons' => array(
'update' => array('visible' => 'Yii::app()->user->checkAccess("updateProject")'),
'delete' => array('visible' => 'Yii::app()->user->checkAccess("deleteProject")'),
),
'updateButtonUrl' => 'Yii::app()->createUrl("project/update",array("id" => $data->id))',
'deleteButtonUrl' => 'Yii::app()->createUrl("project/delete",array("id" => $data->id))',
'viewButtonUrl' => 'Yii::app()->createUrl("project/view",array("id" => $data->id))',
'header'=>CHtml::dropDownList(
'pageSize',
Yii::app()->user->getState('pageSize'),
array(""=>Yii::t('app','Page Size'),5=>5,20=>20,50=>50,100=>100),
array('class'=>'change-pagesize')
),
),
/*
array(
'name' => 'created_by',
'filter' => CHtml::listData(User::model()->findAll(array('order' => 'username')), 'id', 'username'),
'value' => '$data->creator->username'
),
array(
'header' => Yii::t('app', 'Open Tasks'),
'value' => function ($data) {
return Task::model()->public()->count(array('select' => 'id', 'condition' => 'par_project_id = :pid AND status IN (:open, :wip)', 'params' => array('pid' => $data->id, 'open' => 1, 'wip' => 2)));
}
),
array(
'header' => Yii::t('app', 'All Tasks'),
'value' => function ($data) {
return Task::model()->public()->count(array('select' => 'id', 'condition' => 'par_project_id = :pid', 'params' => array('pid' => $data->id)));
}
),
array(
'name' => 'status',
'filter' => CHtml::activeDropDownList($model, 'status', Project::model()->getStatusList(), array('multiple' => true, 'style' => 'display:none')),
'value' => '$data->getStatus()',
),
array(
'class' => 'ext.myGridView.MyButtonColumn',
'buttons' => array(
'update' => array('visible' => 'Yii::app()->user->checkAccess("updateProject")'),
'delete' => array('visible' => 'Yii::app()->user->checkAccess("deleteProject")'),
),
),
),
));
$this->endWidget();
Yii::app()->clientScript->registerScript('initPageSize','
$(".change-pagesize").live("change", function() {
$.fn.yiiGridView.update("project-grid",{ data:{ pageSize: $(this).val() }})
});'
,CClientScript::POS_READY);
?>
</div>
</div>
第二个表格视图代码
<div class="span-24">
<div style="width: 100%; height: 2px; background: #999999; margin-top: 5px;" ></div>
<div class="span-24" style="margin-top: 5px">
<span id="yw4" class="actionstab" style="float:left"> <a class="create" href="#" id="paid"><?php echo Yii::t('app','View Paid Expenses')?></a> </span>
<span id="yw4" class="actionstab" style="float:left"> <a class="create" href="#" id="onGoing"><?php echo Yii::t('app','View On Going Expenses')?></a> </span>
<span id="yw4" class="actionstab" style="float:left;border: none;"> <a class="create" href="#" id="unpaid"><?php echo Yii::t('app','View Pending Expenses')?></a> </span>
<?php
$this->widget('ActionsWidget', array(
'data' => $model,
'template' => '{create}',
//'createButtonUrl' => 'array("procurement/create","id" => '.$id.')',
'createButtonVisible' => 'Yii::app()->user->checkAccess("createExpenses")',
'createButtonLabel' => Yii::t('app','New Expenses')
));
?>
</div>
<div class="span-24">
<?php
$this->beginWidget('CActiveForm', array(
'id' => 'expenses-form',
'enableAjaxValidation' => false,
));
$this->widget('ext.EExcelView', array(
'title' => 'Export Expenses ' . date('Ymd'),
'filename' => 'Export Expenses ' . date('Ymd'),
'selectableRows' => 2,
'id'=>'expenses-grid',
'dataProvider'=>$model->search(),
'afterAjaxUpdate' => "function(id, data){
jQuery('#Expenses_added_date_1').datepicker({'altField':'#Expenses_added_date','altFormat':'yy-mm-dd','dateFormat':'dd/mm/yy'});
jQuery('#Expenses_payment_date_1').datepicker({'altField':'#Expenses_payment_date','altFormat':'yy-mm-dd','dateFormat':'dd/mm/yy'});
}",
'filter'=>$model,
'columns'=>array(
'id',
array(
'header' => Yii::t("app","Project"),
'name' => "project_id",
'filter' => $model->getProjectList(),
'value' => function($data)
{
return $data->project->name;
}
),
'invoice_no',
array(
'name' => 'added_date',
'type' => 'date',
'filter' => CHtml::activeHiddenField($model, 'added_date') . $this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name' => 'Expenses[added_date_1]',
'value' => $model->added_date == null ? '' : Yii::app()->format->date($model->added_date),
'options' => array(
'altField' => '#Expenses_added_date',
'altFormat' => 'yy-mm-dd',
'dateFormat' => 'dd/mm/yy',
'defaultDate' => $model->added_date == null ? '' : Yii::app()->format->date($model->added_date),
),
'htmlOptions' => array(
'size' => '10',
'maxlength' => '10',
'onchange' => 'if(this.value==="") $("#Expenses_added_date").val("");'
),
), true),
'htmlOptions' => array('class' => 'col-date')
),
'amount',
array(
'name' => 'paid_status',
'filter' => $model->getPaidList(),
'value' => function($data)
{
if($data->paid_status == 1)
{
return Yii::t("app","Paid");
}
else if($data->paid_status == 0)
{
return Yii::t("app","Unpaid");
}
else if($data->paid_status == 2)
{
return Yii::t("app","On Going");
}
},
'visible'=>Yii::app()->params['expenses']['paid_status'],
),
array(
'name' => 'payment_date',
'type' => 'date',
'filter' => CHtml::activeHiddenField($model, 'payment_date') . $this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name' => 'Expenses[payment_date_1]',
'value' => $model->added_date == null ? '' : Yii::app()->format->date($model->payment_date),
'options' => array(
'altField' => '#Expenses_payment_date',
'altFormat' => 'yy-mm-dd',
'dateFormat' => 'dd/mm/yy',
'defaultDate' => $model->payment_date == null ? '' : Yii::app()->format->date($model->payment_date),
),
'htmlOptions' => array(
'size' => '10',
'maxlength' => '10',
'onchange' => 'if(this.value==="") $("#Expenses_payment_date").val("");'
),
), true),
'htmlOptions' => array('class' => 'col-date'),
'visible'=>Yii::app()->params['expenses']['payment_date'],
),
array(
'name' => 'description',
'type' => 'html',
'visible'=>Yii::app()->params['expenses']['status'],
),
//'attachment',
array(
'name' => 'status',
'filter' => $model->getStatusList(),
'value' => '$data->status == 1 ? Yii::t("app","Active") : Yii::t("app","Deactive")',
'visible'=>Yii::app()->params['expenses']['status'],
),
array(
'class' => 'ext.myGridView.MyButtonColumn',
'buttons' => array(
'update' => array('visible' => 'Yii::app()->user->checkAccess("updateProject")'),
'delete' => array('visible' => 'Yii::app()->user->checkAccess("deleteProject")'),
),
'updateButtonUrl' => 'Yii::app()->createUrl("expenses/update",array("id" => $data->id))',
'deleteButtonUrl' => 'Yii::app()->createUrl("expenses/delete",array("id" => $data->id))',
'viewButtonUrl' => 'Yii::app()->createUrl("expenses/view",array("id" => $data->id))',
'header'=>CHtml::dropDownList(
'pageSize',
Yii::app()->user->getState('pageSize'),
array(""=>Yii::t('app','Page Size'),5=>5,20=>20,50=>50,100=>100),
array('class'=>'change-pagesize1')
),
),
),
));
$this->endWidget();
Yii::app()->clientScript->registerScript('initPageSize1','
$(".change-pagesize1").live("change", function() {
$.fn.yiiGridView.update("expenses-grid",{ data:{ pageSize: $(this).val() }})
});'
,CClientScript::POS_READY);
?>
</div>
</div>
PDF生成文件:
<?php
Yii::import('zii.widgets.grid.CGridView');
class EExcelView extends CGridView {
//Document properties
public $creator = 'Nikola Kostadinov';
public $title = null;
public $subject = 'Subject';
public $description = '';
public $category = '';
private $_lastRow = 0;
//the PHPExcel object
public $objPHPExcel = null;
public $libPath = 'ext.PHPExcel.Classes.PHPExcel'; //the path to the PHP excel lib
//config
public $autoWidth = true;
public $exportType = 'Excel5';
public $disablePaging = true;
public $filename = null; //export FileName
public $stream = true; //stream to browser
public $grid_mode = 'grid'; //Whether to display grid ot export it to selected format. Possible values(grid, export)
public $grid_mode_var = 'grid_mode'; //GET var for the grid mode
//buttons config
public $exportButtonsCSS = 'export-buttons';
public $exportButtons = array('Excel2007', 'CSV', 'HTML','PDF');
public $exportText = 'Export to: ';
//callbacks
public $onRenderHeaderCell = null;
public $onRenderDataCell = null;
public $onRenderFooterCell = null;
//mime types used for streaming
public $mimeTypes = array(
'Excel5' => array(
'Content-type' => 'application/vnd.ms-excel',
'extension' => 'xls',
'caption' => 'Excel',
'icon' => 'images/actions/excel.png',
),
'Excel2007' => array(
'Content-type' => 'application/vnd.ms-excel',
'extension' => 'xlsx',
'caption' => 'Excel',
'icon' => 'images/actions/excel.png',
),
'PDF' => array(
'Content-type' => 'application/pdf',
'extension' => 'pdf',
'caption' => 'PDF(*.pdf)',
'icon' => 'images/actions/pdf.png',
),
'HTML' => array(
'Content-type' => 'text/html',
'extension' => 'html',
'caption' => 'HTML',
'icon' => 'images/actions/html.png',
),
'CSV' => array(
'Content-type' => 'application/csv',
'extension' => 'csv',
'caption' => 'CSV',
'icon' => 'images/actions/csv.png',
)
);
public function init() {
if (isset($_GET[$this->grid_mode_var]))
$this->grid_mode = $_GET[$this->grid_mode_var];
if (isset($_GET['exportType']))
$this->exportType = $_GET['exportType'];
$this->template = "{summary}\n{items}\n{exportbuttons}"; //\n{pager}";
$this->creator = Yii::app()->params['name'];
array_unshift($this->columns, array(
'id' => 'chkId',
'name' => 'chkId',
'value' => '$data->id',
'class' => 'CCheckBoxColumn'
));
Yii::app()->clientScript->registerScript('no-row-selection', '
$(document).on("click.yiiGridView", ".grid-view td:not(\'.checkbox-column\')", function(){$(this).closest("tr").toggleClass("selected");});
$(document).on("click.yiiGridView", ".grid-view .button-column", function(){$(this).closest("tr").toggleClass("selected");});
$(document).on("click.yiiGridView", ".grid-view .filters", function(){$(this).closest("tr").toggleClass("selected");});
');
$lib = Yii::getPathOfAlias($this->libPath) . '.php';
if ($this->grid_mode == 'export' and !file_exists($lib)) {
$this->grid_mode = 'grid';
Yii::log("PHP Excel lib not found($lib). Export disabled !", CLogger::LEVEL_WARNING, 'EExcelview');
}
if ($this->grid_mode == 'export') {
$this->title = $this->title ? $this->title : Yii::app()->getController()->getPageTitle();
$this->initColumns();
//parent::init();
//Autoload fix
spl_autoload_unregister(array('YiiBase', 'autoload'));
Yii::import($this->libPath, true);
$this->objPHPExcel = new PHPExcel();
PHPExcel_Shared_File::setUseUploadTempDirectory(true);
spl_autoload_register(array('YiiBase', 'autoload'));
// Creating a workbook
$this->objPHPExcel->getProperties()->setCreator($this->creator);
$this->objPHPExcel->getProperties()->setTitle($this->title);
$this->objPHPExcel->getProperties()->setSubject($this->subject);
$this->objPHPExcel->getProperties()->setDescription($this->description);
$this->objPHPExcel->getProperties()->setCategory($this->category);
}
else
parent::init();
}
public function renderHeader() {
$a = 0;
foreach ($this->columns as $column) {
if ($column instanceof CButtonColumn)
// $head = $column->header;
continue;
elseif ($column instanceof CCheckBoxColumn)
continue;
elseif ($column->header === null && $column->name !== null) {
if ($column->grid->dataProvider instanceof CActiveDataProvider)
$head = $column->grid->dataProvider->model->getAttributeLabel($column->name);
else
$head = $column->name;
}
else
$head = trim($column->header) !== '' ? $column->header : $column->grid->blankDisplay;
$a++;
$cell = $this->objPHPExcel->getActiveSheet()->setCellValue($this->columnName($a) . "1", $head, true);
if (is_callable($this->onRenderHeaderCell))
call_user_func_array($this->onRenderHeaderCell, array($cell, $head));
}
}
public function renderBody() {
if ($this->disablePaging) //if needed disable paging to export all data
$this->dataProvider->pagination = false;
$data = $this->dataProvider->getData();
$n = count($data);
$chkIdAll = isset($_POST['chkId']) ? $_POST['chkId'] : array();
if (count($chkIdAll) > 0 && $n > 0) {
for ($row = 0; $row < $n; ++$row) {
if (in_array(CHtml::value($data[$row], 'id'), $chkIdAll))
$this->renderRow($row);
}
}
return $n;
}
public function renderRow($row) {
$data = $this->dataProvider->getData();
$a = 0;
foreach ($this->columns as $n => $column) {
if ($column instanceof CLinkColumn) {
if ($column->labelExpression !== null)
$value = $column->evaluateExpression($column->labelExpression, array('data' => $data[$row], 'row' => $row));
else
$value = $column->label;
} elseif ($column instanceof CButtonColumn)
// $value = ""; //Dont know what to do with buttons
continue;
elseif ($column instanceof CCheckBoxColumn)
continue;
elseif ($column->value !== null)
$value = $this->evaluateExpression($column->value, array('data' => $data[$row]));
elseif ($column->name !== null) {
//$value=$data[$row][$column->name];
$value = CHtml::value($data[$row], $column->name);
$value = $value === null ? '' : $column->grid->getFormatter()->format($value, 'raw');
}
$a++;
$cell = $this->objPHPExcel->getActiveSheet()->setCellValue($this->columnName($a) . ($this->_lastRow + 2), strip_tags($value), true);
if (is_callable($this->onRenderDataCell))
call_user_func_array($this->onRenderDataCell, array($cell, $data[$row], $value));
}
$this->_lastRow++;
}
public function renderFooter($row) {
$a = 0;
foreach ($this->columns as $n => $column) {
$a = $a + 1;
if ($column->footer) {
$footer = trim($column->footer) !== '' ? $column->footer : $column->grid->blankDisplay;
$cell = $this->objPHPExcel->getActiveSheet()->setCellValue($this->columnName($a) . ($row + 2), $footer, true);
if (is_callable($this->onRenderFooterCell))
call_user_func_array($this->onRenderFooterCell, array($cell, $footer));
}
}
}
public function run() {
if ($this->grid_mode == 'export') {
$this->renderHeader();
$row = $this->renderBody();
$this->renderFooter($this->_lastRow);
//set auto width
if ($this->autoWidth)
foreach ($this->columns as $n => $column)
if (!($column instanceof CButtonColumn || $column instanceof CCheckBoxColumn))
$this->objPHPExcel->getActiveSheet()->getColumnDimension($this->columnName($n))->setAutoSize(false);
$lastColumnIndex = 0;
foreach ($this->columns as $column)
if (!($column instanceof CButtonColumn || $column instanceof CCheckBoxColumn))
$lastColumnIndex++;
$lastColumnName = $this->columnName($lastColumnIndex);
$this->objPHPExcel->getActiveSheet()->getStyle('A1:' . $lastColumnName . ++$this->_lastRow)
->applyFromArray(array(
'borders' => array(
'allborders' => array(
'style' => PHPExcel_Style_Border::BORDER_THIN
)
)
));
$this->objPHPExcel->getActiveSheet()->getStyle('A1:' . $lastColumnName . '1')
->applyFromArray(array(
'alignment' => array(
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER,
'rotation' => 0,
'wrap' => TRUE
),
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR,
'rotation' => 270,
'startcolor' => array(
'rgb' => '6FACCF'
),
'endcolor' => array(
'rgb' => 'A8CDE2'
)
),
'font' => array(
'bold' => true,
'color' => array(
'rgb' => 'FFFFFF'
)
)
));
for ($i = 2; $i <= $this->_lastRow; $i++)
$this->objPHPExcel->getActiveSheet()->getStyle('A' . $i . ':' . $lastColumnName . $i)
->applyFromArray(array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array(
'rgb' => $i % 2 === 0 ? 'E5F1F4' : 'F8F8F8'
),
),
));
//create writer for saving
$objWriter = PHPExcel_IOFactory::createWriter($this->objPHPExcel, $this->exportType);
if (!$this->stream)
$objWriter->save($this->filename);
else { //output to browser
if (!$this->filename)
$this->filename = $this->title;
$this->cleanOutput();
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-type: ' . $this->mimeTypes[$this->exportType]['Content-type']);
header('Content-Disposition: attachment; filename="' . $this->filename . '.' . $this->mimeTypes[$this->exportType]['extension'] . '"');
header('Cache-Control: max-age=0');
$objWriter->save('php://output');
Yii::app()->end();
}
}
else
parent::run();
}
public function columnName($index) {
--$index;
if ($index >= 0 && $index < 26)
return chr(ord('A') + $index);
else if ($index > 25)
return ($this->columnName($index / 26)) . ($this->columnName($index % 26 + 1));
else
throw new Exception("Invalid Column # " . ($index + 1));
}
public function renderExportButtons() {
foreach ($this->exportButtons as $key => $button) {
$item = is_array($button) ? CMap::mergeArray($this->mimeTypes[$key], $button) : $this->mimeTypes[$button];
$type = is_array($button) ? $key : $button;
// $url = parse_url(Yii::app()->request->requestUri);
//$content[] = CHtml::link($item['caption'], '?'.$url['query'].'exportType='.$type.'&'.$this->grid_mode_var.'=export');
// $content = array();
// if (key_exists('query', $url))
// $content[] = CHtml::link($item['caption'], '?' . $url['query'] . '&exportType=' . $type . '&' . $this->grid_mode_var . '=export');
// else
// $content[] = CHtml::link($item['caption'], '?exportType=' . $type . '&' . $this->grid_mode_var . '=export');
$submitParams = array(Yii::app()->controller->action->id, 'exportType' => $type, 'grid_mode' => 'export');
foreach ($_GET as $param => $value)
$submitParams[$param] = $value;
$content[] = CHtml::link($item['caption'] . ' ' . CHtml::image(Yii::app()->baseUrl . '/' . $item['icon'], '', array('width' => 16, 'height' => 16)), '#', array('submit' => $submitParams));
}
if ($content) {
// echo CHtml::tag('div', array('class' => $this->exportButtonsCSS), $this->exportText . implode(' ', $content) . $this->renderPager());
echo '<div class="excel-footer">';
$this->renderPager();
echo '<div class="', $this->exportButtonsCSS, '">';
echo $this->exportText . implode(' ', $content);
echo '</div>';
echo '<div style="clear:both;"></div>';
echo '</div>';
}
}
protected static function cleanOutput() {
for ($level = ob_get_level(); $level > 0; --$level) {
@ob_end_clean();
}
}
}
答案 0 :(得分:2)
问题是扩展名调用相同的URL,当网格构建时,它会检查exportgrid参数并执行导出但是没有涉及grid-id,所以第一个网格&#34;捕获&#34;事件并导出结果。
一种可能的解决方案是从模板中删除按钮(仅限第二个网格)
'template'=>"{summary}\n{items}\n{pager}"
之后生成您自己的按钮链接到具有以下代码的操作:
$this->widget('ext.EExcelView', array(
... copy all the values from the view .....
);
或者更好的解决方案是将第二个视图提取到局部视图。所以在上面的动作中你可以渲染这个部分和魔法&#34;将会发生:)
导出按钮必须结束,以便网格&#34;知道&#34;必须导出数据
?exportType='.$type.'&grid_mode=export
其中$ type是导出的类型,例如Excel5
<强>更新强> 我不建议更新扩展,如下面的Manisha Patel所述。解决方案是为每个网格设置不同的出口变量:
$this->widget('ext.EExcelView', array( 'grid_mode_var' => 'grid1_export' .....Other Variable of the gird));
之后,扩展将呈现与新变量的正确链接,或者如果您手动呈现链接,那么您需要将grid_mode_var放在URL中,如下所示:
?exportType=XXXXX&grid1_export=export
where&#34; grid1_export&#34;是通过配置设置var的名称。
答案 1 :(得分:0)
在尼古拉的帮助下,我终于得到了问题的解决方案和这个问题的答案,分两步:
更改Gird视图中的变量grid_mode_var,如Nikola所述,如下所示
$ this-&gt; widget('ext.EExcelView',array('grid_mode_var'=&gt;'grid1_export' .....其他变量的网格));
如下所示更改Nikola所说的下载属性的路径: 1.Got to extenstion / EExcelView.php 2.Find函数renderExportButtons。 3.一旦你找到然后更改行:$ submitParams = array(Yii :: app() - &gt; controller-&gt; action-&gt; id,'exportType'=&gt; $ type,'grid_mode'=&gt; '出口'); 到 $ submitParams = array(Yii :: app() - &gt; controller-&gt; action-&gt; id,'exportType'=&gt; $ type,$ this-&gt; grid_mode_var =&gt; '出口');