Conheça as melhorias da versão 8.0, 8.1, 8.2!
Clique aqui para saber mais
Erro ao executar uma pagina a partir do studio Criei um model e uma pagina no studio Inseri o programa e direitos ao usuario user Ao executar ocorre erro cfe anexo. Class pais e tradecountrylist em anexo ...
MM
Erro ao executar uma pagina a partir do studio  
Criei um model e uma pagina no studio
Inseri o programa e direitos ao usuario user
Ao executar ocorre erro cfe anexo.
Class pais e tradecountrylist em anexo

 
  1. <?php
  2. /**
  3. * Pais Active Record
  4. * @author <your-name-here>
  5. */
  6. class Pais extends TRecord
  7. {
  8. const TABLENAME = 'public.trade_country';
  9. const PRIMARYKEY= 'id';
  10. const IDPOLICY = 'serial'; // {max, serial}
  11. /**
  12. * Constructor method
  13. */
  14. public function __construct($id = NULL, $callObjectLoad = TRUE)
  15. {
  16. parent::__construct($id, $callObjectLoad);
  17. parent::addAttribute('ds_country');
  18. }
  19. }
  20. *******************************************************************
 
  1. <?php
  2. /**
  3. * TradeCountryList Listing
  4. * @author <your name here>
  5. */
  6. class TradeCountryList extends TStandardList
  7. {
  8. protected $form; // registration form
  9. protected $datagrid; // listing
  10. protected $pageNavigation;
  11. protected $formgrid;
  12. protected $deleteButton;
  13. protected $transformCallback;
  14. /**
  15. * Page constructor
  16. */
  17. public function __construct()
  18. {
  19. parent::__construct();
  20. parent::setDatabase('Teste1'); // defines the database
  21. parent::setActiveRecord('TradeCountry'); // defines the active record
  22. parent::setDefaultOrder('id', 'asc'); // defines the default order
  23. // parent::setCriteria($criteria) // define a standard filter
  24. parent::addFilterField('id', 'like', 'id'); // filterField, operator, formField
  25. parent::addFilterField('ds_country', 'like', 'ds_country'); // filterField, operator, formField
  26. // creates the form
  27. $this->form = new TQuickForm('form_search_TradeCountry');
  28. $this->form->class = 'tform'; // change CSS class
  29. $this->form->style = 'display: table;width:100%'; // change style
  30. $this->form->setFormTitle('TradeCountry');
  31. // create the form fields
  32. $id = new TEntry('id');
  33. $ds_country = new TEntry('ds_country');
  34. // add the fields
  35. $this->form->addQuickField('Id', $id, 200 );
  36. $this->form->addQuickField('Ds Country', $ds_country, 200 );
  37. // keep the form filled during navigation with session data
  38. $this->form->setData( TSession::getValue('TradeCountry_filter_data') );
  39. // add the search form actions
  40. $this->form->addQuickAction(_t('Find'), new TAction(array($this, 'onSearch')), 'fa:search');
  41. $this->form->addQuickAction(_t('New'), new TAction(array('TradeCountryForm', 'onEdit')), 'bs:plus-sign green');
  42. // creates a DataGrid
  43. $this->datagrid = new TDataGrid;
  44. $this->datagrid->style = 'width: 100%';
  45. $this->datagrid->datatable = 'true';
  46. // $this->datagrid->enablePopover('Popover', 'Hi <b> {name} </b>');
  47. // creates the datagrid columns
  48. $column_id = new TDataGridColumn('id', 'Id', 'right');
  49. $column_ds_country = new TDataGridColumn('ds_country', 'Ds Country', 'left');
  50. // add the columns to the DataGrid
  51. $this->datagrid->addColumn($column_id);
  52. $this->datagrid->addColumn($column_ds_country);
  53. // create EDIT action
  54. $action_edit = new TDataGridAction(array('TradeCountryForm', 'onEdit'));
  55. $action_edit->setUseButton(TRUE);
  56. $action_edit->setButtonClass('btn btn-default');
  57. $action_edit->setLabel(_t('Edit'));
  58. $action_edit->setImage('fa:pencil-square-o blue fa-lg');
  59. $action_edit->setField('id');
  60. $this->datagrid->addAction($action_edit);
  61. // create DELETE action
  62. $action_del = new TDataGridAction(array($this, 'onDelete'));
  63. $action_del->setUseButton(TRUE);
  64. $action_del->setButtonClass('btn btn-default');
  65. $action_del->setLabel(_t('Delete'));
  66. $action_del->setImage('fa:trash-o red fa-lg');
  67. $action_del->setField('id');
  68. $this->datagrid->addAction($action_del);
  69. // create the datagrid model
  70. $this->datagrid->createModel();
  71. // create the page navigation
  72. $this->pageNavigation = new TPageNavigation;
  73. $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
  74. $this->pageNavigation->setWidth($this->datagrid->getWidth());
  75. // vertical box container
  76. $container = new TVBox;
  77. $container->style = 'width: 90%';
  78. // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
  79. $container->add($this->form);
  80. $container->add($this->datagrid);
  81. $container->add($this->pageNavigation);
  82. parent::add($container);
  83. }
  84. }

Curso Dominando o Adianti Framework

O material mais completo de treinamento do Framework.
Curso em vídeo aulas + Livro completo + Códigos fontes do projeto ERPHouse.
Conteúdo Atualizado!


Dominando o Adianti Framework Quero me inscrever agora!

Comentários (4)


WP

Linha 74

 
  1. <?php
  2. $action_edit = new TDataGridAction(array('TradeCountryForm', 'onEdit'));
  3. ?>


Esta sendo criado uma Action para a clase TradeCountryForm para o metodo onEdit

Tem duas coisas que pode fazer ou
1- Criar o formulario com o nome TradeCountryForm
2- Ou comenta a linha (mas dai fica a pergunta como vai ser imputado os Paises?)
WP

Linha 53 mesma cois

 
  1. <?php
  2. $this->form->addQuickAction(_t('New'), new TAction(array('TradeCountryForm', 'onEdit')), 'bs:plus-sign green');
  3. ?>
MM

Opa!
Crei um novo model e pagina paisform e paisformlist e nao deu erro de execucao na pagina.
O ondelete no grid funciona.
Mas o nova ou editar continua informando permissao negada

 
  1. <?php
  2. /**
  3. * MoedaFormList Listing
  4. * @author <your name here>
  5. */
  6. class MoedaFormList extends TStandardList
  7. {
  8. protected $form; // registration form
  9. protected $datagrid; // listing
  10. protected $pageNavigation;
  11. protected $formgrid;
  12. protected $deleteButton;
  13. protected $transformCallback;
  14. /**
  15. * Page constructor
  16. */
  17. public function __construct()
  18. {
  19. parent::__construct();
  20. parent::setDatabase('Teste1'); // defines the database
  21. parent::setActiveRecord('MoedaForm'); // defines the active record
  22. parent::setDefaultOrder('id', 'asc'); // defines the default order
  23. // parent::setCriteria($criteria) // define a standard filter
  24. parent::addFilterField('id', 'like', 'id'); // filterField, operator, formField
  25. parent::addFilterField('ds_currency', 'like', 'ds_currency'); // filterField, operator, formField
  26. parent::addFilterField('ds_init', 'like', 'ds_init'); // filterField, operator, formField
  27. // creates the form
  28. $this->form = new TQuickForm('form_search_MoedaForm');
  29. $this->form->class = 'tform'; // change CSS class
  30. $this->form->style = 'display: table;width:100%'; // change style
  31. $this->form->setFormTitle('MoedaForm');
  32. // create the form fields
  33. $id = new TEntry('id');
  34. $ds_currency = new TEntry('ds_currency');
  35. $ds_init = new TEntry('ds_init');
  36. // add the fields
  37. $this->form->addQuickField('Id', $id, 200 );
  38. $this->form->addQuickField('Ds Currency', $ds_currency, 200 );
  39. $this->form->addQuickField('Ds Init', $ds_init, 200 );
  40. // keep the form filled during navigation with session data
  41. $this->form->setData( TSession::getValue('MoedaForm_filter_data') );
  42. // add the search form actions
  43. $this->form->addQuickAction(_t('Find'), new TAction(array($this, 'onSearch')), 'fa:search');
  44. $this->form->addQuickAction(_t('New'), new TAction(array('MoedaForm', 'onEdit')), 'bs:plus-sign green');
  45. // creates a DataGrid
  46. $this->datagrid = new TDataGrid;
  47. $this->datagrid->style = 'width: 100%';
  48. $this->datagrid->datatable = 'true';
  49. // $this->datagrid->enablePopover('Popover', 'Hi <b> {name} </b>');
  50. // creates the datagrid columns
  51. $column_id = new TDataGridColumn('id', 'Id', 'right');
  52. $column_ds_currency = new TDataGridColumn('ds_currency', 'Ds Currency', 'left');
  53. $column_ds_init = new TDataGridColumn('ds_init', 'Ds Init', 'left');
  54. // add the columns to the DataGrid
  55. $this->datagrid->addColumn($column_id);
  56. $this->datagrid->addColumn($column_ds_currency);
  57. $this->datagrid->addColumn($column_ds_init);
  58. // create EDIT action
  59. $action_edit = new TDataGridAction(array('MoedaForm', 'onEdit'));
  60. $action_edit->setUseButton(TRUE);
  61. $action_edit->setButtonClass('btn btn-default');
  62. $action_edit->setLabel(_t('Edit'));
  63. $action_edit->setImage('fa:pencil-square-o blue fa-lg');
  64. $action_edit->setField('id');
  65. $this->datagrid->addAction($action_edit);
  66. // create DELETE action
  67. $action_del = new TDataGridAction(array($this, 'onDelete'));
  68. $action_del->setUseButton(TRUE);
  69. $action_del->setButtonClass('btn btn-default');
  70. $action_del->setLabel(_t('Delete'));
  71. $action_del->setImage('fa:trash-o red fa-lg');
  72. $action_del->setField('id');
  73. $this->datagrid->addAction($action_del);
  74. // create the datagrid model
  75. $this->datagrid->createModel();
  76. // create the page navigation
  77. $this->pageNavigation = new TPageNavigation;
  78. $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
  79. $this->pageNavigation->setWidth($this->datagrid->getWidth());
  80. // vertical box container
  81. $container = new TVBox;
  82. $container->style = 'width: 90%';
  83. // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
  84. $container->add($this->form);
  85. $container->add($this->datagrid);
  86. $container->add($this->pageNavigation);
  87. parent::add($container);
  88. }
  89. }
  90. </your>
WP

Deve cadastrar o Programa e logo apos adicionar esse programa para o Grupo de seu usuario
no Youtube tem isso

https://www.youtube.com/watch?v=RnbiddegOoQ