M
Dúvidas com Grid Horizontal x Navegador
- <?php
- /**
- * FormListLocais Listing
- * @author <your name here>
- */
- class FormListLocais extends TPage
- {
- protected $form; // registration form
- protected $datagrid; // listing
- protected $pageNavigation;
- protected $formgrid;
- protected $deleteButton;
-
- use Adianti\base\AdiantiStandardListTrait;
-
- /**
- * Page constructor
- */
- public function __construct()
- {
- parent::__construct();
-
- $this->setDatabase('dbpainel'); // defines the database
- $this->setActiveRecord('Local'); // defines the active record
- $this->setDefaultOrder('bairro', 'setor', 'descricao', 'asc'); // defines the default order
-
- // creates one datagrid
- $this->datagrid = new BootstrapDatagridWrapper(new TQuickGrid);
- $this->datagrid->style = 'width: 1600px;max-width: 1600px';
-
- // creates the datagrid columns
- $column_id = new TDataGridColumn('id', 'Id', 'right');
- $column_setor = new TDataGridColumn('setor', 'Setor', 'center');
- $column_descricao = new TDataGridColumn('descricao', 'Descrição', 'left');
- $column_data_instalacao = new TDataGridColumn('data_instalacao', 'Instalação', 'center');
- $column_valor_custo = new TDataGridColumn('valor_custo', 'Vl. Custo', 'right');
- $column_bairro = new TDataGridColumn('bairro', 'Bairro', 'left');
- $column_id_midia = new TDataGridColumn('id_midia', 'Mídia', 'right');
- // add the columns to the DataGrid
- $this->datagrid->addColumn($column_id);
- $this->datagrid->addColumn($column_setor);
- $this->datagrid->addColumn($column_descricao);
- $this->datagrid->addColumn($column_data_instalacao);
- $this->datagrid->addColumn($column_valor_custo);
- $this->datagrid->addColumn($column_bairro);
- //$this->datagrid->addColumn($column_id_midia);
-
- // creates the datagrid column actions
- $column_setor->setAction(new TAction([$this, 'onReload']), ['order' => 'setor']);
- $column_bairro->setAction(new TAction([$this, 'onReload']), ['order' => 'bairro']);
- // define the transformer method over image
- $column_data_instalacao->setTransformer( function($value, $object, $row) {
- if ($value)
- {
- try
- {
- $date = new DateTime($value);
- return $date->format('d/m/Y');
- }
- catch (Exception $e)
- {
- return $value;
- }
- }
- return $value;
- });
- // define the transformer method over image
- $column_valor_custo->setTransformer( function($value, $object, $row) {
- if (is_numeric($value))
- {
- return 'R$ ' . number_format($value, 2, ',', '.');
- }
- return $value;
- });
- // create EDIT action
- $action_edit = new TDataGridAction(['FormCadLocais', 'onEdit']);
- //$action_edit->setUseButton(TRUE);
- //$action_edit->setButtonClass('btn btn-default');
- $action_edit->setLabel(_t('Edit'));
- $action_edit->setImage('fa:pencil-square-o blue fa-lg');
- $action_edit->setField('id');
- $this->datagrid->addAction($action_edit);
-
- // create DELETE action
- $action_del = new TDataGridAction(array($this, 'onDelete'));
- //$action_del->setUseButton(TRUE);
- //$action_del->setButtonClass('btn btn-default');
- $action_del->setLabel(_t('Delete'));
- $action_del->setImage('fa:trash-o red fa-lg');
- $action_del->setField('id');
- $this->datagrid->addAction($action_del);
-
- // create the datagrid model
- $this->datagrid->createModel();
-
- // create the page navigation
- $this->pageNavigation = new TPageNavigation;
- $this->pageNavigation->setAction(new TAction([$this, 'onReload']));
- $this->pageNavigation->setWidth($this->datagrid->getWidth());
-
- $panel = new TPanelGroup();
- $panel->add($this->datagrid);
- $panel->addFooter('footer');
-
- // turn on horizontal scrolling inside panel body
- $panel->getBody()->style = "overflow-x:auto;";
-
- // wrap the page content using vertical box
- $vbox = new TVBox;
- $vbox->style = 'width: 100%';
- $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
- $vbox->add($panel);
- parent::add($vbox);
- }
- }
Conforme imagem... necessito colocar as duas opções.
Desde já agradeço a ajuda
Tenta alterar a linha
para
Funcionou..
Obrigado pela força..