コード例 #1
0
ファイル: SiteController.php プロジェクト: Aeryris/grid
 public function massAction()
 {
     if ($this->getRequest()->isPost()) {
         echo "<pre>";
         print_r($this->_getAllParams());
         die;
     }
     $grid = $this->grid();
     $select = $this->_db->select()->from('Country');
     $grid->query($select);
     $actions = new Bvb_Grid_Mass_Actions();
     //        $actions->setMassActions(array(array('url' => $grid->getUrl(),
     //                                             'caption' => 'Remove (Nothing will happen)',
     //                                             'confirm' => 'Are you sure?'),
     //                                       array('url' => $grid->getUrl() . '/nothing/happens',
     //                                             'caption' => 'Some other action',
     //                                             'confirm' => 'Another confirmation message?')));
     $actions->addMassAction($grid->getUrl() . '/option/delete', 'Delete', 'Are you sure?');
     $actions->addMassAction($grid->getUrl(), 'Print');
     $grid->setMassActions($actions);
     $grid->setRecordsPerPage(15);
     $grid->setPaginationInterval(array(10 => 10, 20 => 20, 50 => 50, 100 => 100));
     $grid->setTableGridColumns(array('Name', 'Continent', 'Population', 'LocalName', 'GovernmentForm'));
     $grid->setSqlExp(array('Population' => array('functions' => array('SUM'))));
     $this->view->pages = $grid->deploy();
     $this->render('index');
 }
コード例 #2
0
 public function testMassActions()
 {
     $this->grid->setSource(new Bvb_Grid_Source_Zend_Table(new Bugs()));
     $actions = new Bvb_Grid_Mass_Actions();
     $actions->addMassAction($this->grid->getUrl() . '/option/delete', 'Delete', 'Are you sure?');
     $actions->addMassAction($this->grid->getUrl(), 'Print');
     $actions->setMassActionsSeparator(',');
     $actions->setMultipleFieldsSeparator('-');
     $this->grid->setMassActions($actions);
     $grid = $this->grid->deploy();
     $this->controller->getResponse()->setBody($grid);
     $this->assertQuery("[@id='massCheckBox_']");
 }