Lançado Adianti Framework 7.6!
Clique aqui para saber mais
Designer - Datagrid com scroll altura mostra somente 3 linhas Como aumentar a altura da grade para que apareçam mais linhas na grade usando o Designer? Conforme imagem anexa a grade tem altura suficiente para mostrar mais de três registros. Entretanto na execução aparecem só 3, independente de se aumentar a altura no Desginer ou mesmo dentro do programa através do setHeight $this->datagrid2 = $ui->getWidget('datagrid2'); ...
AN
Designer - Datagrid com scroll altura mostra somente 3 linhas  
Como aumentar a altura da grade para que apareçam mais linhas na grade usando o Designer?

Conforme imagem anexa a grade tem altura suficiente para mostrar mais de três registros.

Entretanto na execução aparecem só 3, independente de se aumentar a altura no Desginer ou mesmo dentro do programa através do setHeight

$this->datagrid2 = $ui->getWidget('datagrid2'); $this->datagrid2->setHeight(200); $this->datagrid2->makeScrollable();


Pode-se aumentar os valores tanto no Designer como no programa. Só 3 linhas da grade são mostradas.

Para se mostrar as outras -->scroll.

Alguém tem a solução?

Grato

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


NR

Fiz um teste aqui e funcionou a altura definida no designer. Poste seu xml que tento executá-lo aqui.
AN

<?xml version="1.0" encoding="UTF-8"?>
<form>
<tlabel id="0">
<class>TLabel</class>
<name>label1</name>
<x>1</x>
<y>9</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>No. Máximo de Fornecedores:</value>
</tlabel>
<tspinner id="1">
<class>TSpinner</class>
<name>maximo_fornecedores</name>
<x>195</x>
<y>5</y>
<value>1</value>
<width>50</width>
<editable>1</editable>
<tip>Informe o número máximo de fornecedores para cotação</tip>
<step>1</step>
<max>10</max>
<min>1</min>
</tspinner>
<tlabel id="2">
<class>TLabel</class>
<name>label2</name>
<x>280</x>
<y>9</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>No. de Últimos Fornecedores:</value>
</tlabel>
<tspinner id="3">
<class>TSpinner</class>
<name>ultimos_fornecedores</name>
<x>470</x>
<y>5</y>
<value>1</value>
<width>50</width>
<editable>1</editable>
<tip>Informe o número de últimos fornecedores para a cotação</tip>
<step>1</step>
<max>50</max>
<min>1</min>
</tspinner>
<tbutton id="4">
<class>TButton</class>
<name>button1</name>
<x>555</x>
<y>5</y>
<value>Mudar Critérios</value>
<icon>ico_up.png</icon>
<action>OnMudar</action>
<template></template>
</tbutton>
<tdatagrid id="5">
<class>TDataGrid</class>
<name>datagrid</name>
<x>0</x>
<y>35</y>
<loader>OnReload</loader>
<template>reload.php</template>
<width>910</width>
<height>150</height>
<columns>
<tdatagridcolumn id="1">
<name>item</name>
<align>left</align>
<label>Item</label>
<width>20</width>
</tdatagridcolumn>
<tdatagridcolumn id="2">
<name>cod_produto</name>
<align>left</align>
<label>Produto</label>
<width>80</width>
</tdatagridcolumn>
<tdatagridcolumn id="3">
<name>unidade</name>
<align>left</align>
<label>Unidade</label>
<width>100</width>
</tdatagridcolumn>
<tdatagridcolumn id="4">
<name>quantidade</name>
<align>right</align>
<label>Quantidade</label>
<width>100</width>
</tdatagridcolumn>
<tdatagridcolumn id="5">
<name>necessidade</name>
<align>center</align>
<label>Necessidade</label>
<width>82</width>
</tdatagridcolumn>
<tdatagridcolumn id="6">
<name>cod_almox</name>
<align>center</align>
<label>Almox.</label>
<width>50</width>
</tdatagridcolumn>
<tdatagridcolumn id="7">
<name>descricao</name>
<align>left</align>
<label>Descrição</label>
<width>400</width>
</tdatagridcolumn>
</columns>
<actions>
<tdatagridaction id="1">
<method>OnCarrega</method>
<image>ico_view.png</image>
<field>cod_produto</field>
<label>Mostrar</label>
<template></template>
</tdatagridaction>
</actions>
<pagenavigator>yes</pagenavigator>
</tdatagrid>
<tnotebook id="6">
<class>TNotebook</class>
<name>notebook2</name>
<x>0</x>
<y>265</y>
<width>940</width>
<height>270</height>
<pages>
<tpanel id="1" tab="Fornecedores Selecionados">
<tdatagrid id="0">
<class>TDataGrid</class>
<name>datagrid1</name>
<x>5</x>
<y>15</y>
<loader></loader>
<template></template>
<width>760</width>
<height>200</height>
<columns>
<tdatagridcolumn id="1">
<name>marca</name>
<align>left</align>
<label>X</label>
<width>20</width>
</tdatagridcolumn>
<tdatagridcolumn id="2">
<name>cod_fornecedor</name>
<align>left</align>
<label>Código</label>
<width>71</width>
</tdatagridcolumn>
<tdatagridcolumn id="3">
<name>loja</name>
<align>left</align>
<label>Loja</label>
<width>48</width>
</tdatagridcolumn>
<tdatagridcolumn id="4">
<name>id2razao_social</name>
<align>left</align>
<label>Nome/Razão Social</label>
<width>350</width>
</tdatagridcolumn>
<tdatagridcolumn id="5">
<name>cgc_cpf</name>
<align>left</align>
<label>Cnpj / Cpf</label>
<width>100</width>
</tdatagridcolumn>
<tdatagridcolumn id="6">
<name>id_fornecedor</name>
<align>left</align>
<label>Id</label>
<width>82</width>
</tdatagridcolumn>
</columns>
<actions>
<tdatagridaction id="1">
<method>OnMostrar</method>
<image>ico_view.png</image>
<field>id_fornecedor</field>
<label>Mostrar Dados</label>
<template></template>
</tdatagridaction>
<tdatagridaction id="2">
<method>OnMarcar</method>
<image>ico_edit.png</image>
<field>id_fornecedor</field>
<label>Marcar/Desmarcar</label>
<template></template>
</tdatagridaction>
</actions>
<pagenavigator>no</pagenavigator>
</tdatagrid>
<tbutton id="1">
<class>TButton</class>
<name>button2</name>
<x>835</x>
<y>90</y>
<value>Finalizar</value>
<icon>ico_ok.png</icon>
<action>OnFInalizar</action>
<template></template>
</tbutton>
<tbutton id="2">
<class>TButton</class>
<name>button3</name>
<x>835</x>
<y>55</y>
<value>Incluir Novo</value>
<icon>ico_new.png</icon>
<action>OnIncluir</action>
<template></template>
</tbutton>
<tlabel id="3">
<class>TLabel</class>
<name>label3</name>
<x>840</x>
<y>185</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>Marcados</value>
</tlabel>
<tentry id="4">
<class>TEntry</class>
<name>marcados</name>
<x>850</x>
<y>205</y>
<value></value>
<mask>999</mask>
<width>50</width>
<maxlen>3</maxlen>
<editable>0</editable>
<tip></tip>
<required></required>
</tentry>
<tlabel id="5">
<class>TLabel</class>
<name>label17</name>
<x>840</x>
<y>135</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>Cotação</value>
</tlabel>
<tlabel id="6">
<class>TLabel</class>
<name>label18</name>
<x>840</x>
<y>155</y>
<color>#1B12A7</color>
<size>10</size>
<style>b,i</style>
<value>-</value>
</tlabel>
</tpanel>
<tpanel id="2" tab="Dados do Fornecedor">
<tlabel id="0">
<class>TLabel</class>
<name>label4</name>
<x>20</x>
<y>5</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>Razão Social / Nome</value>
</tlabel>
<tlabel id="1">
<class>TLabel</class>
<name>label5</name>
<x>580</x>
<y>5</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>Nome de Fantasia</value>
</tlabel>
<tentry id="2">
<class>TEntry</class>
<name>razao_social</name>
<x>30</x>
<y>25</y>
<value></value>
<mask></mask>
<width>475</width>
<maxlen>0</maxlen>
<editable>0</editable>
<tip></tip>
<required></required>
</tentry>
<tentry id="3">
<class>TEntry</class>
<name>fantasia</name>
<x>590</x>
<y>25</y>
<value></value>
<mask></mask>
<width>322</width>
<maxlen>0</maxlen>
<editable>0</editable>
<tip></tip>
<required></required>
</tentry>
<tlabel id="4">
<class>TLabel</class>
<name>label6</name>
<x>20</x>
<y>60</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>Endereço</value>
</tlabel>
<tlabel id="5">
<class>TLabel</class>
<name>label7</name>
<x>580</x>
<y>60</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>Bairro</value>
</tlabel>
<tentry id="6">
<class>TEntry</class>
<name>endereco</name>
<x>30</x>
<y>80</y>
<value></value>
<mask></mask>
<width>475</width>
<maxlen>0</maxlen>
<editable>0</editable>
<tip></tip>
<required></required>
</tentry>
<tentry id="7">
<class>TEntry</class>
<name>bairro</name>
<x>590</x>
<y>80</y>
<value></value>
<mask></mask>
<width>322</width>
<maxlen>0</maxlen>
<editable>0</editable>
<tip></tip>
<required></required>
</tentry>
<tlabel id="8">
<class>TLabel</class>
<name>label8</name>
<x>20</x>
<y>115</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>Cidade</value>
</tlabel>
<tentry id="9">
<class>TEntry</class>
<name>cidade</name>
<x>30</x>
<y>135</y>
<value></value>
<mask></mask>
<width>290</width>
<maxlen>0</maxlen>
<editable>0</editable>
<tip></tip>
<required></required>
</tentry>
<tlabel id="10">
<class>TLabel</class>
<name>label9</name>
<x>330</x>
<y>115</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>UF</value>
</tlabel>
<tentry id="11">
<class>TEntry</class>
<name>uf</name>
<x>340</x>
<y>135</y>
<value></value>
<mask></mask>
<width>30</width>
<maxlen>0</maxlen>
<editable>0</editable>
<tip></tip>
<required></required>
</tentry>
<tlabel id="12">
<class>TLabel</class>
<name>label10</name>
<x>390</x>
<y>115</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>Contato</value>
</tlabel>
<tentry id="13">
<class>TEntry</class>
<name>contato</name>
<x>400</x>
<y>135</y>
<value></value>
<mask></mask>
<width>370</width>
<maxlen>0</maxlen>
<editable>0</editable>
<tip></tip>
<required></required>
</tentry>
<tlabel id="14">
<class>TLabel</class>
<name>label11</name>
<x>775</x>
<y>115</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>Telefone</value>
</tlabel>
<tentry id="15">
<class>TEntry</class>
<name>telefone</name>
<x>785</x>
<y>135</y>
<value></value>
<mask></mask>
<width>125</width>
<maxlen>0</maxlen>
<editable>0</editable>
<tip></tip>
<required></required>
</tentry>
<tlabel id="16">
<class>TLabel</class>
<name>label12</name>
<x>20</x>
<y>175</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>Maior Compra</value>
</tlabel>
<tlabel id="17">
<class>TLabel</class>
<name>label13</name>
<x>180</x>
<y>175</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>Maior Saldo</value>
</tlabel>
<tlabel id="18">
<class>TLabel</class>
<name>label14</name>
<x>390</x>
<y>175</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>Média de Atraso</value>
</tlabel>
<tlabel id="19">
<class>TLabel</class>
<name>label15</name>
<x>500</x>
<y>175</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>Transportador</value>
</tlabel>
<tentry id="20">
<class>TEntry</class>
<name>maior_compra</name>
<x>30</x>
<y>195</y>
<value></value>
<mask></mask>
<width>130</width>
<maxlen>0</maxlen>
<editable>0</editable>
<tip></tip>
<required></required>
</tentry>
<tentry id="21">
<class>TEntry</class>
<name>maior_saldo</name>
<x>190</x>
<y>195</y>
<value></value>
<mask></mask>
<width>130</width>
<maxlen>0</maxlen>
<editable>0</editable>
<tip></tip>
<required></required>
</tentry>
<tentry id="22">
<class>TEntry</class>
<name>media</name>
<x>400</x>
<y>195</y>
<value></value>
<mask></mask>
<width>40</width>
<maxlen>0</maxlen>
<editable>0</editable>
<tip></tip>
<required></required>
</tentry>
<tentry id="23">
<class>TEntry</class>
<name>transportador</name>
<x>510</x>
<y>195</y>
<value></value>
<mask></mask>
<width>400</width>
<maxlen>0</maxlen>
<editable>0</editable>
<tip></tip>
<required></required>
</tentry>
</tpanel>
<tpanel id="3" tab="Ultimas Compras do Produto Selecionado">
<tdatagrid id="0">
<class>TDataGrid</class>
<name>datagrid2</name>
<x>5</x>
<y>25</y>
<loader></loader>
<template></template>
<width>880</width>
<height>200</height>
<columns>
<tdatagridcolumn id="1">
<name>id2</name>
<align>left</align>
<label>id</label>
<width>110</width>
</tdatagridcolumn>
<tdatagridcolumn id="2">
<name>id2razao_social</name>
<align>left</align>
<label>Nome / Razão Social</label>
<width>300</width>
</tdatagridcolumn>
<tdatagridcolumn id="3">
<name>id2data</name>
<align>center</align>
<label>Data</label>
<width>60</width>
</tdatagridcolumn>
<tdatagridcolumn id="4">
<name>id2quantidade</name>
<align>right</align>
<label>Quantidade</label>
<width>100</width>
</tdatagridcolumn>
<tdatagridcolumn id="5">
<name>id2unitario</name>
<align>right</align>
<label>Vlr. Unitário</label>
<width>100</width>
</tdatagridcolumn>
<tdatagridcolumn id="6">
<name>id2nota_fiscal</name>
<align>left</align>
<label>Nota Fiscal</label>
<width>90</width>
</tdatagridcolumn>
<tdatagridcolumn id="7">
<name>id2serie</name>
<align>left</align>
<label>Série</label>
<width>45</width>
</tdatagridcolumn>
</columns>
<actions>
<tdatagridaction id="1">
<method>OnMostrarCompra</method>
<image>ico_view.png</image>
<field>id2</field>
<label>Mostrar Compra</label>
<template></template>
</tdatagridaction>
</actions>
<pagenavigator>no</pagenavigator>
</tdatagrid>
<tlabel id="1">
<class>TLabel</class>
<name>label20</name>
<x>280</x>
<y>5</y>
<color>#150083</color>
<size>10</size>
<style>i</style>
<value>Clique Na Lupa Para Ver Nota Fiscal de Entrada </value>
</tlabel>
</tpanel>
</pages>
</tnotebook>
<tlabel id="7">
<class>TLabel</class>
<name>label16</name>
<x>290</x>
<y>245</y>
<color>#150083</color>
<size>10</size>
<style>i</style>
<value>*</value>
</tlabel>
<tlabel id="8">
<class>TLabel</class>
<name>label19</name>
<x>705</x>
<y>10</y>
<color>#000000</color>
<size>10</size>
<style></style>
<value>Solicitação:</value>
</tlabel>
<tentry id="9">
<class>TEntry</class>
<name>id</name>
<x>790</x>
<y>5</y>
<value></value>
<mask></mask>
<width>147</width>
<maxlen>0</maxlen>
<editable>0</editable>
<tip></tip>
<required></required>
</tentry>
<tbutton id="10">
<class>TButton</class>
<name>button4</name>
<x>1</x>
<y>235</y>
<value>Voltar Para Listagem</value>
<icon>ico_edit.png</icon>
<action>OnVolta</action>
<template></template>
</tbutton>
</form>
AN

Nataniel gravei um video usando um screen recorder. Posso enviá-lo caso queira ver o que está acontecendo com a grade.

Meu e-mail é armando.fortex@gmail.com

Se puder me envia uma mensagem que te retorno o vídeo.

Grato
NR

Tente o seguinte:
  1. <?php
  2. $this->datagrid2->setHeight(200);
  3. $this->datagrid2->clearChildren();
  4. $this->datagrid2->makeScrollable();
  5. $this->datagrid2->createModel();
  6. ?>
AN

Do mesmo jeito Nataniel.

Façamos o seguinte. Fiz uma grade simples que roda tranquilo. Por favor execute o programa .

Aqui apareceu as exatas 3 linhas. Vou te mandar a classe e o xml. Me diga quantas linhas aparece aí. Se for mais de 3 então tem alguma coisa no adianti que baixei aqui.

----------------------- Classe

  1. <?php
  2. /**
  3.  * testedegrade Registration
  4.  * @author  <your name here>
  5.  */
  6. class testedegrade extends TPage
  7. {
  8.     private $form;
  9.     private $datagrid;
  10.    // private $pageNavigation;
  11.    // private $loaded;
  12.     
  13.     /**
  14.      * Class constructor
  15.      * Creates the page and the registration form
  16.      */
  17.     function __construct()
  18.     {
  19.         parent::__construct();
  20.         
  21.         // creates the form
  22.         $this->form = new TForm('form_colaboradores');
  23.         
  24.         try
  25.         {
  26.             // TUIBuilder object
  27.             $ui = new TUIBuilder(500,500);
  28.             $ui->setController($this);
  29.             $ui->setForm($this->form);
  30.             
  31.             // reads the xml form
  32.             $ui->parseFile('app/forms/testedegradeForm.form.xml');
  33.             
  34.             // get the interface widgets
  35.             $fields $ui->getWidgets();
  36.             $this->datagrid $ui->getWidget('datagrid');             
  37.             
  38.             
  39.             // look for the TDataGrid object
  40.             foreach ($fields as $name => $field)
  41.             {
  42.                 if ($field instanceof TDataGrid)
  43.                 {
  44.                     $this->datagrid $field;
  45.             //        $this->pageNavigation = $this->datagrid->getPageNavigation();
  46.                 }
  47.             }
  48.             $this->datagrid->setHeight(440);
  49.             $this->datagrid->makeScrollable();
  50.             
  51.             // add the TUIBuilder panel inside the TForm object
  52.             $this->form->add($ui);
  53.             
  54.             // set form fields from interface fields
  55.             $this->form->setFields($ui->getFields());
  56.         }
  57.         catch (Exception $e)
  58.         {
  59.             new TMessage('error'$e->getMessage());
  60.         }
  61.         
  62.         // add the form to the page
  63.         parent::add($this->form);
  64.     }
  65.     
  66.     public function OnCarrega()
  67.     {
  68.            $this->datagrid->clear();
  69.            for ($i=1$i<=20$i++)
  70.            {
  71.                $item = new StdClass;
  72.                $item->codigo 'Cód: ' strval($i);
  73.                $item->nome 'TESTANDO LINHA' strval($i);
  74.                $this->datagrid->addItem($item);
  75.            }
  76.     }   
  77. }
  78. ?>



-----------xml

<?xml version="1.0" encoding="UTF-8"?>
<form>
<tnotebook id="0">
<class>TNotebook</class>
<name>notebook1</name>
<x>25</x>
<y>25</y>
<width>877</width>
<height>507</height>
<pages>
<tpanel id="1" tab="Teste de Scroll de grade">
<tdatagrid id="0">
<class>TDataGrid</class>
<name>datagrid</name>
<x>5</x>
<y>15</y>
<loader></loader>
<template></template>
<width>300</width>
<height>440</height>
<columns>
<tdatagridcolumn id="1">
<name>codigo</name>
<align>left</align>
<label>Id</label>
<width>70</width>
</tdatagridcolumn>
<tdatagridcolumn id="2">
<name>nome</name>
<align>left</align>
<label>Teste</label>
<width>190</width>
</tdatagridcolumn>
</columns>
<actions/>
<pagenavigator>no</pagenavigator>
</tdatagrid>
<tbutton id="1">
<class>TButton</class>
<name>button1</name>
<x>380</x>
<y>20</y>
<value>Carregar Grade</value>
<icon>ico_save.png</icon>
<action>OnCarrega</action>
<template></template>
</tbutton>
</tpanel>
</pages>
</tnotebook>
</form>
</your>
NR

Testei e aparecem 15 linhas. Você chegou a testar em outro navegador?
AN

Nataniel.

Mais uma vez obrigado.

Então o problema está na minha máquina...

Testei no firefox e no chrome no Linux.

Vou mudar a distibuição Linux. Tentar com Linux Mint.

Voce roda em windows ou linux?