AS
Paginação Default
Fechado
boa noite galera, estou usando o seguinte codigo
vi esse codigo no tutor mantive ate os comentarios
essa paginação default dele aparece depois de quantos registros?
- <?php
- /** class de controle de funcionarios
- * author Alexandre E. Souza
- */
- class FornecedorView extends TStandardList{
- protected $form; // registration form
- protected $datagrid; // listing
- protected $pageNavigation;
- /**
- * Class constructor
- * Creates the page, the form and the listing
- */
- public function __construct()
- {
- parent::__construct();
- new TSession;
- // defines the database
- parent::setDatabase('mysql');
- // defines the active record
- parent::setActiveRecord('Fornecedor');
- // define the filter field
- parent::setFilterField('razaoSocial');
- // creates the form
- $this->form = new TForm('form_search_produto');
- // creates a table
- $table = new TTable;
- // add the table inside the form
- $this->form->add($table);
- // create the form fields
- $name = new TEntry('razaoSocial');
- $name->setValue(TSession::getValue('razaoSocial'));
- // add a row for the field name
- $row=$table->addRow();
- $row->addCell(new TLabel('Razão Social:'));
- $row->addCell($name);
- // create two action buttons to the form
- $find_button = new TButton('find');
- $new_button = new TButton('new');
- // define the button actions
- $find_button->setAction(new TAction(array($this, 'onSearch')), 'Find');
- $find_button->setImage('ico_find.png');
- $new_button->setAction(new TAction(array('frmFornecedor', 'onEdit')), 'New');
- $new_button->setImage('ico_new.png');
- // add a row for the form actions
- $row=$table->addRow();
- $row->addCell($find_button);
- $row->addCell($new_button);
- // define wich are the form fields
- $this->form->setFields(array($name, $find_button, $new_button));
- // creates a DataGrid
- $this->datagrid = new TQuickGrid;
- $this->datagrid->setHeight(230);
- // creates the datagrid columns
- $this->datagrid->addQuickColumn('id', 'id', 'right', 40, new TAction(array($this, 'onReload')), array('order', 'id'));
- $this->datagrid->addQuickColumn('Razão Social', 'razaoSocial', 'left', 250, new TAction(array($this, 'onReload')), array('order', 'razaoSocial'));
- $this->datagrid->addQuickColumn('Responsavel', 'responsavel', 'right',100);
- $this->datagrid->addQuickColumn('Telefone', 'telefone', 'right', 100);
- $this->datagrid->addQuickColumn('Cidade', 'cidade', 'right', 100);
- $this->datagrid->addQuickColumn('Bairro', 'bairro', 'right', 100);
- $this->datagrid->addQuickColumn('Rua', 'rua', 'right', 100);
- // creates two datagrid actions
- $this->datagrid->addQuickAction('Edit', new TDataGridAction(array('frmFornecedor', 'onEdit')), 'id', 'ico_edit.png');
- $this->datagrid->addQuickAction('Delete', new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
- // create the datagrid model
- $this->datagrid->createModel();
- // creates the page navigation
- $this->pageNavigation = new TPageNavigation;
- $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
- $this->pageNavigation->setWidth($this->datagrid->getWidth());
- // creates the page structure using a table
- $table = new TTable;
- $table->addRow()->addCell($this->form);
- $table->addRow()->addCell($this->datagrid);
- $table->addRow()->addCell($this->pageNavigation);
- // add the table inside the page
- parent::add($table);
- }
- }
- ?>
vi esse codigo no tutor mantive ate os comentarios
essa paginação default dele aparece depois de quantos registros?
Oi Alexandre,
Veja no código da TStandardList, que são 10:
www.adianti.com.br/api-framework-control-TStandardList#onReload
Mas você pode configurar por meio do setLimit():
www.adianti.com.br/api-framework-control-TStandardList#setLimit
abs,
Pablo
vlw pablo
Pablo,
Em uma listagem estou tentando definir o limite de registros por página com o método <? setLimit(30); ?> porém sem sucesso, a página segue sendo gerada com o limite padrão (10 registros).
Segue abaixo o código (vide linha 128):
no codigo acima a classe AtorList estende TStandardList e a paginação vem de TStandardList por isso deve ser usado o comando parent::setLimit(30);