/** * Usage * php index.php show example grid --page 1 * php index.php show example grid --page 2 * * @return \Zend\Http\Response\Stream */ public function consoleAction() { /* @var $grid \ZfcDatagrid\Datagrid */ $grid = $this->getServiceLocator()->get('zf2datatablegrid'); $grid->setTitle('Persons'); $grid->setDefaultItemsPerPage(5); $grid->setDataSource($this->getServiceLocator()->get('zfcDatagrid.examples.data.zendSelect')->getPersons()); $col = new Column\Select('id'); $col->setIdentity(); $grid->addColumn($col); $col = new Column\Select('displayName'); $col->setLabel('Displayname'); $col->setWidth(25); $col->setSortDefault(1, 'ASC'); $col->addStyle(new Style\Bold()); $grid->addColumn($col); $col = new Column\Select('familyName'); $col->setLabel('Familyname'); $col->setWidth(15); $grid->addColumn($col); $col = new Column\Select('givenName'); $col->setLabel('Givenname'); $col->setWidth(15); $grid->addColumn($col); $col = new Column\Select('age'); $col->setLabel('Age'); $col->setWidth(10); $col->setType(new Type\Number()); $grid->addColumn($col); $grid->render(); return $grid->getResponse(); }