删除zf-datagrid中特定表的导出选项

时间:2014-02-18 11:15:46

标签: zend-framework datagrid

我想删除一些

的datagrid导出选项('pdf','csv','excel','word'等...)

zend框架的datagrid中的特定table。它现在默认为每个

附在项目上的表,我该怎么做?谢谢 。发布datagrid的代码

下面的帮助

public function dataGrid($sql){

    $this->view->headLink()->appendStylesheet($this->view->baseUrl('grid/styles/styles.css'));
        $this->view->setEncoding('ISO-8859-1');
        $config = new Zend_Config_Ini(APPLICATION_PATH. '/configs/grid.ini', 'production');
        $grid = Bvb_Grid::factory('Table', $config, 'grid');
        $grid->setExport(array());
        $backendName = Zend_Cache::$standardBackends[0];
        $frontendName  = Zend_Cache::$standardFrontends[0];
        $frontendOptions = array('automatic_serialization'=> true);
        $backendOptions = array('auto_refresh_fast_cache'=> true);
        $cache = Zend_Cache::factory($frontendName,
                             $backendName,$frontendOptions,$backendOptions);
        $grid->setExport(array('pdf', 'csv','excel','word'));
        $grid->addFiltersRenderDir(APPLICATION_PATH.'/views/helpers/Filters/', 'Filters');
        $grid->setPaginationInterval(array(100 =>100, 200 => 200, 500 => 500, 1000 => 1000));
        $grid->setUseKeyEventsOnFilters(true);
        $grid->query($sql);       
        return $grid;
    }

1 个答案:

答案 0 :(得分:1)

$grid->setGridColumns($grid_columns);
$grid->setExport(array()); 
$gd = $grid->deploy();

您可以通过将空数组传递给null函数

将导出选项设置为setExport