Conheça as melhorias da versão 8.0, 8.1, 8.2!
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. public function __construct()
  16. {
  17. parent::__construct();
  18. // creates one datagrid
  19. $this->datagrid = new BootstrapDatagridWrapper(new TDataGrid);
  20. $this->datagrid->width = '100%';
  21. // add the columns
  22. $this->datagrid->addColumn( new TDataGridColumn('code', 'Code', 'center', '10%') );
  23. $this->datagrid->addColumn( new TDataGridColumn('name', 'Name', 'left', '30%') );
  24. $this->datagrid->addColumn( new TDataGridColumn('city', 'City', 'left', '30%') );
  25. $this->datagrid->addColumn( new TDataGridColumn('state', 'State', 'left', '30%') );
  26. $action1 = new TDataGridAction([$this, 'onView'], ['code'=>'{code}', 'name' => '{name}'] );
  27. $this->datagrid->addAction($action1, 'View', 'fa:search blue');
  28. // creates the datagrid model
  29. $this->datagrid->createModel();
  30. // search box
  31. $input_search = new TEntry('input_search');
  32. $input_search->placeholder = _t('Search');
  33. $input_search->setSize('100%');
  34. // enable fuse search by column name
  35. $this->datagrid->enableSearch($input_search, 'code, name, city, state');
  36. $panel = new TPanelGroup( _t('Datagrid search') );
  37. $panel->addHeaderWidget($input_search);
  38. $panel->add($this->datagrid)->style = 'overflow-x:auto';
  39. $panel->addFooter('footer');
  40. // wrap the page content using vertical box
  41. $vbox = new TVBox;
  42. $vbox->style = 'width: 100%';
  43. $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
  44. $vbox->add($panel);
  45. parent::add($vbox);
  46. }
  47. /**
  48. * Load the data into the datagrid
  49. */
  50. function onReload()
  51. {
  52. $this->datagrid->clear();
  53. // add an regular object to the datagrid
  54. $item = new StdClass;
  55. $item->code = '1';
  56. $item->name = 'Aretha Franklin Gonçalves Affonso da Armênia';
  57. $item->city = 'Memphis';
  58. $item->state = 'Tennessee (US)';
  59. $this->datagrid->addItem($item);
  60. // add an regular object to the datagrid
  61. $item = new StdClass;
  62. $item->code = '2';
  63. $item->name = 'Eric Clapton';
  64. $item->city = 'Ripley';
  65. $item->state = 'Surrey (UK)';
  66. $this->datagrid->addItem($item);
  67. // add an regular object to the datagrid
  68. $item = new StdClass;
  69. $item->code = '3';
  70. $item->name = 'B.B. King';
  71. $item->city = 'Itta Bena';
  72. $item->state = 'Mississippi (US)';
  73. $this->datagrid->addItem($item);
  74. // add an regular object to the datagrid
  75. $item = new StdClass;
  76. $item->code = '4';
  77. $item->name = 'Janis Joplin';
  78. $item->city = 'Port Arthur';
  79. $item->state = 'Texas (US)';
  80. $this->datagrid->addItem($item);
  81. }
  82. /**
  83. * Executed when the user clicks at the view button
  84. */
  85. public static function onView($param)
  86. {
  87. // get the parameter and shows the message
  88. $code = $param['code'];
  89. $name = $param['name'];
  90. new TMessage('info', "The code is: <b>$code</b> <br> The name is : <b>$name</b>");
  91. }
  92. /**
  93. * shows the page
  94. */
  95. function show()
  96. {
  97. $this->onReload();
  98. parent::show();
  99. }
  100. }
  101. ?>


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