Lançado Adianti Framework 7.6!
Clique aqui para saber mais
BUSCA NO DATAGRID Quando tenho uma coluna com um texto muito grande, se o trecho que quero estiver no final, a busca não é feita. Vou postar o código do próprio tutor para ver se me faço entender. Eu acrescentei sobrenomes à Aretha Franklin. Na busca se digitar os dois últimos sobrenomes, não mostra nada. ...
AA
BUSCA NO DATAGRID  
Quando tenho uma coluna com um texto muito grande, se o trecho que quero estiver no final, a busca não é feita. Vou postar o código do próprio tutor para ver se me faço entender. Eu acrescentei sobrenomes à Aretha Franklin. Na busca se digitar os dois últimos sobrenomes, não mostra nada.
  1. <?php
  2. /**
  3.  * DatagridSearchView
  4.  *
  5.  * @version    1.0
  6.  * @package    samples
  7.  * @subpackage tutor
  8.  * @author     Pablo Dall'Oglio
  9.  * @copyright  Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
  10.  * @license    http://www.adianti.com.br/framework-license
  11.  */
  12. class DatagridSearchView extends TPage
  13. {
  14.     private $datagrid;
  15.     
  16.     public function __construct()
  17.     {
  18.         parent::__construct();
  19.         
  20.         // creates one datagrid
  21.         $this->datagrid = new BootstrapDatagridWrapper(new TDataGrid);
  22.         $this->datagrid->width '100%';
  23.         
  24.         // add the columns
  25.         $this->datagrid->addColumn( new TDataGridColumn('code',    'Code',    'center''10%') );
  26.         $this->datagrid->addColumn( new TDataGridColumn('name',    'Name',    'left',   '30%') );
  27.         $this->datagrid->addColumn( new TDataGridColumn('city',    'City',    'left',   '30%') );
  28.         $this->datagrid->addColumn( new TDataGridColumn('state',   'State',   'left',   '30%') );
  29.         
  30.         $action1 = new TDataGridAction([$this'onView'],   ['code'=>'{code}',  'name' => '{name}'] );
  31.         $this->datagrid->addAction($action1'View''fa:search blue');
  32.         
  33.         // creates the datagrid model
  34.         $this->datagrid->createModel();
  35.         
  36.         // search box
  37.         $input_search = new TEntry('input_search');
  38.         $input_search->placeholder _t('Search');
  39.         $input_search->setSize('100%');
  40.         
  41.         // enable fuse search by column name
  42.         $this->datagrid->enableSearch($input_search'code, name, city, state');
  43.         
  44.         $panel = new TPanelGroup_t('Datagrid search') );
  45.         $panel->addHeaderWidget($input_search);
  46.         $panel->add($this->datagrid)->style 'overflow-x:auto';
  47.         $panel->addFooter('footer');
  48.         
  49.         // wrap the page content using vertical box
  50.         $vbox = new TVBox;
  51.         $vbox->style 'width: 100%';
  52.         $vbox->add(new TXMLBreadCrumb('menu.xml'__CLASS__));
  53.         $vbox->add($panel);
  54.         parent::add($vbox);
  55.     }
  56.     
  57.     /**
  58.      * Load the data into the datagrid
  59.      */
  60.     function onReload()
  61.     {
  62.         $this->datagrid->clear();
  63.         
  64.         // add an regular object to the datagrid
  65.         $item = new StdClass;
  66.         $item->code   '1';
  67.         $item->name   'Aretha Franklin Gonçalves Affonso da Armênia';
  68.         $item->city   'Memphis';
  69.         $item->state  'Tennessee (US)';
  70.         $this->datagrid->addItem($item);
  71.         
  72.         // add an regular object to the datagrid
  73.         $item = new StdClass;
  74.         $item->code   '2';
  75.         $item->name   'Eric Clapton';
  76.         $item->city   'Ripley';
  77.         $item->state  'Surrey (UK)';
  78.         $this->datagrid->addItem($item);
  79.         
  80.         // add an regular object to the datagrid
  81.         $item = new StdClass;
  82.         $item->code   '3';
  83.         $item->name   'B.B. King';
  84.         $item->city   'Itta Bena';
  85.         $item->state  'Mississippi (US)';
  86.         $this->datagrid->addItem($item);
  87.         
  88.         // add an regular object to the datagrid
  89.         $item = new StdClass;
  90.         $item->code   '4';
  91.         $item->name   'Janis Joplin';
  92.         $item->city   'Port Arthur';
  93.         $item->state  'Texas (US)';
  94.         $this->datagrid->addItem($item);
  95.     }
  96.     
  97.     /**
  98.      * Executed when the user clicks at the view button
  99.      */
  100.     public static function onView($param)
  101.     {
  102.         // get the parameter and shows the message
  103.         $code $param['code'];
  104.         $name $param['name'];
  105.         new TMessage('info'"The code is: <b>$code</b> <br> The name is : <b>$name</b>");
  106.     }
  107.     
  108.     /**
  109.      * shows the page
  110.      */
  111.     function show()
  112.     {
  113.         $this->onReload();
  114.         parent::show();
  115.     }
  116. }
  117. ?>


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