LG
duas tabelas no arquivo ClienteFrom.class
no arquivo ClienteForm.class pretendo mostrar duas tabelas:
- <?php
- function onReload($param = NULL)
- {
- try
- {
- TTransaction::open('conexao');
- $repository = new TRepository('VContasreceber');
- $criteria = new TCriteria;
- $criteria->add( new TFilter( 'ID_CLIENTE', '=', '$ID_CLIENTE' ));
- $objects = $repository->load( $criteria );
- $this->datagrid->clear();
- if($objects)
- {
- foreach($objects as $object)
- {
- $this->datagrid->addItem($object);
- }
- }
- ?>
- <?php
- /**
- * ClienteForm Registration
- * @author <your name here>
- */
- class ClienteForm extends TWindow
- {
- protected $form; // form
- use Adianti\Base\AdiantiStandardFormTrait; // Standard form methods
- /**
- * Class constructor
- * Creates the page and the registration form
- */
- function __construct()
- {
- parent::__construct();
- $this->setDatabase('conexao'); // defines the database
- $this->setActiveRecord('Cliente'); // defines the active record
- // creates the form
- $this->form = new TQuickForm('form_Cliente');
- $this->form->class = 'tform'; // change CSS class
- $this->form->style = 'display: table;width:100%'; // change style
- // create the HTML Renderer
- // define the form title
- //$this->form->setTitle('Dados Cadastrais:');
- $titulos =new TLabel('Dados Cadastrais:');
- $titulos->Style="color: white;font-weight: bold; ";
- $row = $this->form->addRow();
- $row->style = "background-color:#2989e0; height: 42px; -moz-border-radius: 10px; ";
- // $row->class = 'tformsection';
- $row->addCell($titulos)->colspan =23;
- $row = $this->form->addRow();
- $row->style = "background-color:#2989e0; height: 9px; ";
- $CODIGO = new TLabel('');
- $CODIGO ->setName('CODIGO');
- $RAZAO_SOCIAL = new TLabel('');
- $RAZAO_SOCIAL ->setName('RAZAO_SOCIAL');
- $NOME_FANTASIA = new TLabel('');
- $NOME_FANTASIA->setName('NOME_FANTASIA');
- $ENDERECO = new TLabel('');
- $ENDERECO->setName('ENDERECO');
- $NUMERO = new TLabel('');
- $NUMERO->setName('NUMERO');
- $COMPLEMENTO = new TLabel('');
- $COMPLEMENTO->setName('COMPLEMENTO');
- $BAIRRO = new TLabel('');
- $BAIRRO->setName('BAIRRO');
- $ID_CIDADE= new TLabel('');
- $ID_CIDADE->setName('NOME_CIDADE');
- $estado= new TLabel('');
- $estado->setName('UF');
- $FONE = new TLabel('');
- $FONE->setName('FONE');
- $CELULAR = new TLabel('');
- $CELULAR->setName('CELULAR');
- $EMAIL = new TLabel('');
- $EMAIL->setName('EMAIL');
- $CNPJCPF = new TLabel('');
- $CNPJCPF->setName('CNPJCPF');
- $IDENTINSC = new TLabel('');
- $IDENTINSC->setName('IDENTINSC');
- $vazio = new TLabel('');
- // add the fields
- $titulos =new TLabel('Titulos Abertos:');
- $titulos->Style="color: white;font-weight: bold";
- $this->form->addQuickField('Codigo:',$CODIGO, 700 );
- $this->form->addQuickField('Razao Social:', $RAZAO_SOCIAL, 500 );
- $this->form->addQuickField('Nome Fantasia:', $NOME_FANTASIA, 500 );
- $this->form->addQuickFields('Endereço:', array($ENDERECO, $NUMERO, $COMPLEMENTO));
- $this->form->addQuickField('Bairro:', $BAIRRO, 500 );
- $this->form->addQuickField('Cidade:', $ID_CIDADE);
- $this->form->addQuickField('Estado:', $estado, 500 );
- $this->form->addQuickFields('Telefone/Celular:', array($FONE,$CELULAR));
- $this->form->addQuickField('Email:', $EMAIL, 500 );
- $this->form->addQuickField('CNPJ/CPF:', $CNPJCPF,500);
- $this->form->addQuickField('Identidade/Inscrição:', $IDENTINSC,500);
- //$this->form->addQuickField('', $vazio,500);
- $row = $this->form->addRow();
- $row->style = "background-color:#2989e0; height: 9px; ";
- $row = $this->form->addRow();
- $row->style = "background-color:#2989e0; height: 42px;border-radius: 10px ";
- // $row->class = 'tformsection';
- $row->addCell($titulos)->colspan =23;
- /*$this->datagrid = new TDataGrid;
- $this->datagrid->disableDefaultClick(); // important!
- $this->datagrid->style = 'width: 100%';
- $this->datagrid->setHeight(320);
- $this->datagrid->addQuickColumn('Nota', 'NUMERO_NOTA', 'left', 40, new TAction(array($this, 'onReload')), array('NUMERO_NOTA'));*/
- /* $this->datagrid->addQuickColumn('Série', 'name', 'left', 170);
- $this->datagrid->addQuickColumn('Emissão', 'city->name', 'left', 140);
- $this->datagrid->addQuickColumn('Documento', 'address', 'left', 190);
- $this->datagrid->addQuickColumn('Vencimento', 'address', 'left', 190);
- $this->datagrid->addQuickColumn('Valor', 'address', 'left', 190);
- $this->datagrid->addQuickColumn('Tipo', 'address', 'left', 190);*/
- // $this->datagrid->createModel();
- if (!empty($ID_CLIENTE))
- {
- $ID_CLIENTE->setEditable(FALSE);
- }
- /** samples
- $this->form->addQuickFields('Date', array($date1, new TLabel('to'), $date2)); // side by side fields
- $fieldX->addValidation( 'Field X', new TRequiredValidator ); // add validation
- $fieldX->setSize( 100, 40 ); // set size
- **/
- // create the form actions
- //$this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'fa:floppy-o');
- //$this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'bs:plus-sign green');
- // vertical box container
- $container = new TVBox;
- $container->style = 'width: 100%; ';
- // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
- $container->add($this->form);
- parent::setTitle('Detalhes do Cliente:');
- parent::add($container);
- }
- }
- Mas nao estou conseguindo.
- Segue imagem. Comforme a mesma queria colocar a respectiva tabela Vcontasreceber(model) abaixo do texto Titulos abertos:
Você criou a função onReload, mas ela está sendo chamada? E essa função está adicionando itens em uma datagrid, mas pelo que vi no construtor a instância da variável $this->datagrid está comentada, ou seja, essa variável não existe
addQuickColumn é uma função da classe TQuickGrid e você está usando a TDataGrid
... substituindo...
$this->datagrid = new TQuickGrid ;
$this->datagrid->disableDefaultClick(); // important!
$this->datagrid->style = 'width: 100%';
$this->datagrid->setHeight(320);
$this->datagrid->addQuickColumn('Nota', 'NUMERO_NOTA', 'left', 40, new TAction(array($this, 'onReload')), array('NUMERO_NOTA'));
//$this->datagrid->addQuickColumn('Nota', 'NUMERO_NOTA', 'center', 40);
$this->datagrid->createModel();
da a janela do erro:
Método AdiantiControlTAction::__construct deve receber um parâmetro do tipo Callback
Verifique se a ação (ClienteForm::onReload) existe
File: appcontroladminClienteForm.class.php : 160
AdiantiControlTAction->__construct(ClienteForm,onReload)
File: libadianticoreAdiantiCoreApplication.php : 51
ClienteForm->__construct(ClienteForm,onedit,2,2)
File: engine.php : 20
AdiantiCoreAdiantiCoreApplication::run(1)
File: engine.php : 39
TApplication::run(1)