RR
Não consigo gerar resultado com onSearch.
Estou com o seguinte problema quando vou pesquisar qualquer tipo de dado no campo de pesquisa ele processa mais não traz nenhum resultado o que sera que pode ser segue abaixo o codigo:
class ContasDataGridView3 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();
parent::setDatabase('samples'); // defines the database
parent::setActiveRecord('Contas'); // defines the active record
parent::addFilterField('fornecedor ', 'like', 'fornecedor '); // filter field, operator, form field
parent::setDefaultOrder('idcontas', 'asc'); // define the default order
// creates the form
$this->form = new TQuickForm('form_search_Contas');
$this->form->setFormTitle('Listagem de contas');
$this->form->class = 'tform';
$this->form->style = 'width: 1110px';
$fornecedor = new TEntry('fornecedor');
$this->form->addQuickField('Fornecedor:', $fornecedor, '70%' );
$this->form->addQuickAction('Procurar', new TAction(array($this, 'onSearch')), 'fa:search blue');
$this->form->addQuickAction('Novo', new TAction(array('ContasFormView3', 'onClear')), 'fa:plus-circle green');
// keep the form filled with the search data
$this->form->setData(TSession::getValue('Contas_filter_data'));
// creates the DataGrid
$this->datagrid = new TQuickGrid;
$this->datagrid->style = "width: 100%";
// creates the datagrid columns
$this->datagrid->addQuickColumn('Id', 'idcontas', 'right', '5%', new TAction(array($this, 'onReload')), array('order', 'idcontas'));
$this->datagrid->addQuickColumn('Fornecedor', 'fornecedor', 'left', '35%', new TAction(array($this, 'onReload')), array('order', 'fornecedor'));
$this->datagrid->addQuickColumn('Historico', 'historico', 'left', '60%', new TAction(array($this, 'onReload')), array('order', 'historico'));
$this->datagrid->addQuickColumn('Vencimento', 'vencimento', 'left', '60%', new TAction(array($this, 'onReload')), array('order', 'vencimento'));
$this->datagrid->addQuickColumn('P. Contas', 'plano_conta', 'left', '70%', new TAction(array($this, 'onReload')), array('order', 'plano_conta'));
$this->datagrid->addQuickColumn('Filial', 'filial', 'left', '80%', new TAction(array($this, 'onReload')), array('order', 'filial'));
$this->datagrid->addQuickColumn('Pagamento', 'forma_pgto', 'left', '70%', new TAction(array($this, 'onReload')), array('order', 'forma_pgto'));
$this->datagrid->addQuickColumn('Valor', 'valor', 'left', '70%', new TAction(array($this, 'onReload')), array('order', 'valor'));
// creates two datagrid actions
$this->datagrid->addQuickAction('Editar', new TDataGridAction(array('ContasFormView3', 'onEdit')), 'idcontas', 'fa:edit blue');
$this->datagrid->addQuickAction('Deletar', new TDataGridAction(array($this, 'onDelete')), 'idcontas', 'fa:trash red');
// 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
$vbox = new TVBox;
$vbox->add($this->form);
$vbox->add($this->datagrid);
$vbox->add($this->pageNavigation);
// add the table inside the page
parent::add($vbox);
}
class ContasDataGridView3 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();
parent::setDatabase('samples'); // defines the database
parent::setActiveRecord('Contas'); // defines the active record
parent::addFilterField('fornecedor ', 'like', 'fornecedor '); // filter field, operator, form field
parent::setDefaultOrder('idcontas', 'asc'); // define the default order
// creates the form
$this->form = new TQuickForm('form_search_Contas');
$this->form->setFormTitle('Listagem de contas');
$this->form->class = 'tform';
$this->form->style = 'width: 1110px';
$fornecedor = new TEntry('fornecedor');
$this->form->addQuickField('Fornecedor:', $fornecedor, '70%' );
$this->form->addQuickAction('Procurar', new TAction(array($this, 'onSearch')), 'fa:search blue');
$this->form->addQuickAction('Novo', new TAction(array('ContasFormView3', 'onClear')), 'fa:plus-circle green');
// keep the form filled with the search data
$this->form->setData(TSession::getValue('Contas_filter_data'));
// creates the DataGrid
$this->datagrid = new TQuickGrid;
$this->datagrid->style = "width: 100%";
// creates the datagrid columns
$this->datagrid->addQuickColumn('Id', 'idcontas', 'right', '5%', new TAction(array($this, 'onReload')), array('order', 'idcontas'));
$this->datagrid->addQuickColumn('Fornecedor', 'fornecedor', 'left', '35%', new TAction(array($this, 'onReload')), array('order', 'fornecedor'));
$this->datagrid->addQuickColumn('Historico', 'historico', 'left', '60%', new TAction(array($this, 'onReload')), array('order', 'historico'));
$this->datagrid->addQuickColumn('Vencimento', 'vencimento', 'left', '60%', new TAction(array($this, 'onReload')), array('order', 'vencimento'));
$this->datagrid->addQuickColumn('P. Contas', 'plano_conta', 'left', '70%', new TAction(array($this, 'onReload')), array('order', 'plano_conta'));
$this->datagrid->addQuickColumn('Filial', 'filial', 'left', '80%', new TAction(array($this, 'onReload')), array('order', 'filial'));
$this->datagrid->addQuickColumn('Pagamento', 'forma_pgto', 'left', '70%', new TAction(array($this, 'onReload')), array('order', 'forma_pgto'));
$this->datagrid->addQuickColumn('Valor', 'valor', 'left', '70%', new TAction(array($this, 'onReload')), array('order', 'valor'));
// creates two datagrid actions
$this->datagrid->addQuickAction('Editar', new TDataGridAction(array('ContasFormView3', 'onEdit')), 'idcontas', 'fa:edit blue');
$this->datagrid->addQuickAction('Deletar', new TDataGridAction(array($this, 'onDelete')), 'idcontas', 'fa:trash red');
// 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
$vbox = new TVBox;
$vbox->add($this->form);
$vbox->add($this->datagrid);
$vbox->add($this->pageNavigation);
// add the table inside the page
parent::add($vbox);
}
vc esta pesquisando pelo fornecedor na tabela está salvo o nome ou o id do fornecedor?
Esta salvo o nome do fornecedor