Lançado Adianti Framework 7.6!
Clique aqui para saber mais
Caracter aparecendo fora da grid Olá Pessoal, Estou tendo o seguinte problema a carregar uma grid, esta aparecendo uma letra v acima da grid e não consigo identificar onde esta o erro. Alguém pode me ajudar ? segue fonte abaixo: ...
RB
Caracter aparecendo fora da grid  
Olá Pessoal,
Estou tendo o seguinte problema a carregar uma grid, esta aparecendo uma letra v acima da grid e não consigo identificar onde esta o erro.

Alguém pode me ajudar ?
segue fonte abaixo:

  1. <?php
  2. /**
  3.  * DataGridClienteFisico
  4.  *
  5.  */
  6. class DataGridClienteFisico extends TPage
  7. {
  8.     private $datagrid$pageNavigation$loaded;
  9.     
  10.     public function __construct()
  11.     {
  12.         parent::__construct();
  13.         
  14.         // creates one datagrid
  15.         $this->datagrid = new BootstrapDatagridWrapper(new TDataGrid);
  16.         $this->datagrid->width '100%';
  17.         
  18.         // add the columns
  19.         $this->datagrid->addColumn(new TDataGridColumn('pessoa_id','#','center',''));
  20.         $nome $this->datagrid->addColumn(new TDataGridColumn('pessoa->fisica->nome',_t('Name'),'left',''));
  21.         $data_cadastro $this->datagrid->addColumn(new TDataGridColumn('criacao','Data Cadastro','left',''));
  22.         $telefone $this->datagrid->addColumn(new TDataGridColumn('telefone->numero','Telefone','left',''));
  23.         //$unidade = $this->datagrid->addColumn(new TDataGridColumn('contato->nome','Email','left',''));
  24.         $cpf $this->datagrid->addColumn(new TDataGridColumn('pessoa->fisica->cpf','CPF','left',''));
  25.         $rg $this->datagrid->addColumn(new TDataGridColumn('pessoa->fisica->rg','RG','left',''));
  26.         $uf $this->datagrid->addColumn(new TDataGridColumn('pessoa_endereco->endereco->estado->nome','Cidade','left',''));
  27.         $cidade $this->datagrid->addColumn(new TDataGridColumn('pessoa_endereco->endereco->estado->uf','UF','left',''));
  28.         $data_cadastro->enableAutoHide(500);
  29.         $telefone->enableAutoHide(600);
  30.         //$unidade->enableAutoHide(700);
  31.         $cpf->enableAutoHide(800);
  32.         $rg->enableAutoHide(900);
  33.         $uf->enableAutoHide(1000);
  34.         $cidade->enableAutoHide(1000);
  35.         $uf->setDataProperty('style','font-weight: bold');
  36.         $data_cadastro->setTransformer(array($this'formatDate'));        
  37.         
  38.         $action1 = new TDataGridAction(['FisicaForm','onEdit'],['id'=>'{pessoa_id}'] );
  39.         $this->datagrid->addAction($action1'Edit','fa:search blue');
  40.         
  41.         // creates the datagrid model
  42.         $this->datagrid->createModel();
  43.         // creates the page navigation
  44.         $this->pageNavigation = new TPageNavigation;
  45.         $this->pageNavigation->setAction(new TAction([$this'onReload']));
  46.         $this->pageNavigation->setWidth($this->datagrid->getWidth());
  47.         $this->pageNavigation->enableCounters();
  48.         
  49.         // search box
  50.         $input_search = new TEntry('input_search');
  51.         $input_search->placeholder _t('Search');
  52.         $input_search->setSize('100%');
  53.         
  54.         // enable fuse search by column name
  55.         $this->datagrid->enableSearch($input_search,'pessoa_id,criacao,pessoa->fisica->nome,telefone->numero,pessoa->fisica->cpf,pessoa->fisica->rg');
  56.         
  57.         $panel = new TPanelGroup('{$cliente}');
  58.         $panel->addHeaderWidget($input_search);
  59.         $panel->add($this->datagrid)->style 'overflow-x:auto';
  60.         $panel->addFooter($this->pageNavigation);
  61.         
  62.         // wrap the page content using vertical box
  63.         $vbox = new TVBox;
  64.         $vbox->style 'width: 100%';
  65.         //$vbox->add(new TXMLBreadCrumb('menu.xml','Cliente'));
  66.         $vbox->add($panel);
  67.         parent::add($vbox);
  68.     }
  69.     public function formatDate($date$object)
  70.     {
  71.         $dt = new DateTime($date);
  72.         return $dt->format('d/m/Y');
  73.     }
  74.     
  75.     /**
  76.      * method onReload()
  77.      * Load the datagrid with the database objects
  78.      */
  79.     function onReload($param NULL)
  80.     {
  81.         try
  82.         {
  83.             // open a transaction with database 'db'
  84.             TTransaction::open('sgv');
  85.             
  86.             // creates a repository for PessoaVinculo
  87.             $repository = new TRepository('PessoaVinculo');
  88.             $limit 10;
  89.             
  90.             // creates a criteria
  91.             $criteria = new TCriteria;
  92.             
  93.             // default order
  94.             if (empty($param['order']))
  95.             {
  96.                 $param['order'] = 'pessoa_id';
  97.                 $param['direction'] = 'asc';
  98.             }
  99.             
  100.             $criteria->setProperties($param); // order, offset
  101.             $criteria->setProperty('limit'$limit);            
  102.                       
  103.             // load the objects according to criteria
  104.             $objects $repository->load($criteria);
  105.             
  106.             $this->datagrid->clear();
  107.             if ($objects)
  108.             {
  109.                 // iterate the collection of active records
  110.                 foreach ($objects as $object)
  111.                 {
  112.                     // add the object inside the datagrid
  113.                     $this->datagrid->addItem($object);
  114.                 }
  115.             }
  116.             
  117.             // reset the criteria for record count
  118.             $criteria->resetProperties();
  119.             $count $repository->count($criteria);
  120.             
  121.             $this->pageNavigation->setCount($count); // count of records
  122.             $this->pageNavigation->setProperties($param); // order, page
  123.             $this->pageNavigation->setLimit($limit); // limit
  124.             
  125.             // close the transaction
  126.             TTransaction::close();
  127.             $this->loaded true;
  128.         }
  129.         catch (Exception $e// in case of exception
  130.         {
  131.             new TMessage('error'$e->getMessage()); // shows the exception error message
  132.             TTransaction::rollback(); // undo all pending operations
  133.         }
  134.     }
  135.         
  136.    /**
  137.      * shows the page
  138.      */
  139.     function show()
  140.     {
  141.         $this->onReload();
  142.         parent::show();
  143.     }

Curso completo Meu Negócio Pronto
Use para si, ou transforme em um negócio: Inclui aulas e códigos-fontes
Gestor de conteúdo (SITE) + Loja Virtual (E-Commerce) + Emissor de Notas para infoprodutos


Meu negócio pronto Quero me inscrever agora!

Comentários (2)


NR

Pelo que deu pra ver tem uma classe anterior adicionando os botões "Físico" e "Jurídico". Esse "v" não está lá?
RB

Então,

Eu fiz o teste só com a classe separada, para ver se era isto.

E o tal do v, continua aparecendo.