Lançado Adianti Framework 7.6!
Clique aqui para saber mais
Bug TEntry - Atualização 1.0.2 Olá Pessoal! Não sei se já aconteceu com alguém, mas depois da atualização para a versão 1.0.2 apareceu um Bug no componente TDate: Ao colocar 2 TDate no mesmo formulário o segundo não aparece a caixa de seleção de data, conforme ilustro na imagem - http://uploaddeimagens.com.br/imagens/bug_tdate-png . Caso alguém tenha alguma ideia, favor expô-la por favor. att. Eliezer...
ES
Bug TEntry - Atualização 1.0.2  
Fechado
Olá Pessoal!
Não sei se já aconteceu com alguém, mas depois da atualização para a versão 1.0.2 apareceu um Bug no componente TDate:
Ao colocar 2 TDate no mesmo formulário o segundo não aparece a caixa de seleção de data, conforme ilustro na imagem - uploaddeimagens.com.br/imagens/bug_tdate-png .

Caso alguém tenha alguma ideia, favor expô-la por favor.

att.
Eliezer

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 (10)


AS

posta a parte do codigo

eu usei 2 e foi normal
ES

  1. <?php function __construct()
  2.     {
  3.         parent::__construct();
  4.         
  5.         TPage::include_js('app/lib/include/funcoesGerais.jquery.js');
  6.         
  7.         // security check
  8.         if (TSession::getValue('logged') !== TRUE)
  9.         {
  10.             throw new Exception(_t('Not logged'));
  11.         }
  12.         
  13.         // security check
  14.         TTransaction::open('changeman');
  15.         if (Member::newFromLogin(TSession::getValue('login'))-> perfil_admin !== 'Y')
  16.         {
  17.             throw new Exception(_t('Permission denied'));
  18.         }
  19.         TTransaction::close();
  20.         
  21.         // creates the form
  22.         $this->form = new TForm('form_Bens_moveis_diag');
  23.         
  24.         // creates a table
  25.         $table = new TTable;
  26.         
  27.         // add the table inside the form
  28.         $this->form->add($table);
  29.         
  30.         // create the form fields
  31.         $id                             = new TEntry('id');       
  32.         $ano                            = new TEntry('ano');
  33.         $diag_nome                      = new TEntry('diag_nome');
  34.         $data_ini                       = new TDate('data_ini');
  35.         $data_fim                       = new TDate('data_fim');
  36.         $status                         = new TEntry('status');
  37.         // define the sizes
  38.         $id->setSize(50);
  39.         $id->setEditable(FALSE);
  40.         $id->setProperty('align''center');
  41.         
  42.         $ano->setSize(60);
  43.         $ano->setValue(date('Y'));
  44.         $ano->setProperty('align''center');
  45.         
  46.         $diag_nome->setSize(120);
  47.         $diag_nome->setValue('01 - '.date('Y'));
  48.         $diag_nome->setProperty('align''center');
  49.         
  50.         $data_ini->setSize(80);
  51.         $data_ini->setMask('dd/mm/yyyy');
  52.         $data_ini->setProperty('align''center');
  53.         
  54.         $data_fim->setSize(80);
  55.         $data_fim->setMask('dd/mm/yyyy');
  56.         $data_fim->setProperty('align''center');
  57.         
  58.         //Opções
  59.         $items = array();
  60.         $items['ABERTO']='ABERTO';
  61.         $items['FECHADO']='FECHADO';
  62.         $items['FINALIZADO']='FINALIZADO';
  63.         
  64.         $status->setSize(200);
  65.         $status->setEditable(FALSE);
  66.         //$status->addItems($items);
  67.         $status->setValue('ABERTO');
  68.         // validations
  69.         $ano->addValidation('Ano', new TRequiredValidator);
  70.         $diag_nome->addValidation('Descrição', new TRequiredValidator);
  71.         $data_ini->addValidation('Início', new TRequiredValidator);
  72.         $data_fim->addValidation('Fim', new TRequiredValidator);
  73.         $status->addValidation('Status', new TRequiredValidator);
  74.         // add a row for the field id
  75.         $row=$table->addRow();
  76.         $row->addCell(new TLabel('ID:'));
  77.         $row->addCell($id);
  78.         // add a row for the field ano
  79.         $row=$table->addRow();
  80.         $row->addCell(new TLabel('Ano:'));
  81.         $row->addCell($ano);
  82.         
  83.         // add a row for the field diag_nome
  84.         $row->addCell(new TLabel('Descrição:'));
  85.         $row->addCell($diag_nome);
  86.         // add a row for the field data_ini
  87.         $row=$table->addRow();
  88.         $row->addCell(new TLabel('Início:'));
  89.         $row->addCell($data_ini);
  90.         // add a row for the field data_fim
  91.         //$row=$table->addRow();
  92.         $row->addCell(new TLabel('Fim:'));
  93.         $row->addCell($data_fim);
  94.         // add a row for the field status
  95.         $row=$table->addRow();
  96.         $row->addCell(new TLabel('Status:'));
  97.         $cell $row->addCell($status);
  98.         $cell->colspan=3;
  99.         // create an action button (save)
  100.         $save_button=new TButton('save');
  101.         $save_button->setAction(new TAction(array($this'onSave')), _t('Save'));
  102.         $save_button->setImage('ico_save.png');
  103.  
  104.         // create an new button (edit with no parameters)
  105.         $new_button=new TButton('new');
  106.         $new_button->setAction(new TAction(array($this'onEdit')), _t('New'));
  107.         $new_button->setImage('ico_new.png');
  108.         $this->form->setFields(array($id,$ano$diag_nome,$data_ini,$data_fim,$status,$save_button,$new_button));
  109.         
  110.         // creates a DataGrid
  111.         $this->datagrid = new TDataGrid;
  112.         $this->datagrid->setHeight(320);
  113.         
  114.         // creates the datagrid columns
  115.         $id   = new TDataGridColumn('id''ID''left'40);
  116.         $ano   = new TDataGridColumn('diag_nome''Descrição''center'100);
  117.         $data_ini   = new TDataGridColumn('data_ini''Início''center'60);
  118.         $data_fim   = new TDataGridColumn('data_fim''Fim''center'60);
  119.         $status   = new TDataGridColumn('status''Status''left'200);
  120.         
  121.         $status->setTransformer(array($this'corStatus'));
  122.         // add the columns to the DataGrid
  123.         $this->datagrid->addColumn($id);
  124.         $this->datagrid->addColumn($ano);
  125.         $this->datagrid->addColumn($data_ini);
  126.         $this->datagrid->addColumn($data_fim);
  127.         $this->datagrid->addColumn($status);
  128.         
  129.         // creates two datagrid actions
  130.         $action1 = new TDataGridAction(array($this'onEdit'));
  131.         $action1->setLabel(_t('Edit'));
  132.         $action1->setImage('ico_edit.png');
  133.         $action1->setField('id');
  134.         
  135.         $action2 = new TDataGridAction(array($this'onDelete'));
  136.         $action2->setLabel(_t('Delete'));
  137.         $action2->setImage('ico_delete.png');
  138.         $action2->setField('id');
  139.         
  140.         // add the actions to the datagrid
  141.         $this->datagrid->addAction($action1);
  142.         $this->datagrid->addAction($action2);
  143.         
  144.         // create the datagrid model
  145.         $this->datagrid->createModel();
  146.         
  147.         // creates the page navigation
  148.         $this->pageNavigation = new TPageNavigation;
  149.         $this->pageNavigation->setAction(new TAction(array($this'onReload')));
  150.         $this->pageNavigation->setWidth($this->datagrid->getWidth());
  151.         
  152.         $table_buttons = new TTable;
  153.         $row_buttons $table_buttons->addRow();
  154.         $row_buttons->addCell($save_button);
  155.         $row_buttons->addCell($new_button);
  156.         
  157.         // creates the page structure using a table
  158.         $table = new TTable;
  159.         $table->addRow()->addCell($this->form);
  160.         $table->addRow()->addCell($table_buttons);
  161.         $table->addRow()->addCell($this->datagrid);
  162.         $table->addRow()->addCell($this->pageNavigation);
  163.         
  164.         // add the table inside the page
  165.         parent::add($table);
  166.     } ?>
AS

tenta aumentar a celula da data_fim, para ver se algo com o tamanho
ES

Não resolve o problema.

Vou tentar atualizar todas as classes novamente.
PD

Eliezer,

Sugiro você fazer um teste CLEAN, somente com as coisas originais do framework.
Aí então, vai adicionando as .JS específicas que você acrescentou.
Pode ser que alguma coisa tá dando conflito, pq aqui tá normal...

abraço,
Pablo
DS

Eu estou tendo o mesmo problema, baixei o tuto e ao acessar a classe ProjectForm apresenta o mesmo problema que o print. Apenas o primeiro campo data está aparecendo o calendário.
WW

Pessoal, bom dia!

Quando adiciono mais de um campo do tipo TDate em um formulário, somente um dos
campos exibe o calendário e nos demais não aparecem o botão calendário.

Caso alguém tiver a solução, favor enviar.

Att.
Watson William
PD

Watson,

Teste a aplicação tutor e veja se isso acontece. Acredito que seja um bug relacionado à CSS específico de sua aplicação...

att,
Pablo
JD

Apesar de ser um post antigo, vou postar a solução definitiva do problema.
Verifiquei que no construtor da classe TDate é setado um id da seguinte maneira:
  1. <?php
  2. public function __construct($name)
  3.     {
  4.         parent::__construct($name);
  5.         $this->id   'tdate_'.uniqid();
  6. ?>


Note que é utilizado a função uniqid() do PHP que gera um id "ÚNICO" de acordo com o tempo atual em milionésimos de segundo, porém identifiquei no html da tela que os dois campos estavam com o mesmo ID e esta é a verdadeira causa do problema, pois a função responsável por adicionar o datapicker usa como referencia o ID do componente, como os dois componentes possuem o mesmo id a função acaba adicionando o datapicker no primeiro componente renderezado.
Resolvi o problema trocando a função uniqid() para:
  1. <?php
  2. public function __construct($name)
  3.     {
  4.         parent::__construct($name);
  5.         $this->id   'tdate_'.uniqid(rand(0,100));
  6. ?>

E assim garanti que fosse gerado um ID unico e o bug foi resolvido.
Por alguma razão a função uniqid() retorna o mesmo valor ao ser executada no mesmo momento duas ou mais vezes, porem passando um paramentro que seria um prefixo do id único esse bug é resolvido, e para garantir usei a função rand() que gerar um valor aleatório entre os valores informados nos parâmetros.
Espero que isso ajude.
PD

Esse bug foi resolvido definitivamente na próxima versão que será lançada em breve.
Foi usada a função mt_rand(), melhor que a rand().
O bug só se manifestava em Windows, onde a uniqid() falha em alguns casos.

Att,
Pablo