Angular Virtualização e desempenho da grade
In Ignite UI for Angular, the IgxGrid control now utilizes the igxForOf directive and virtualizes its content both vertically and horizontally.
Angular Grid Virtualization and Performance Example
Enabling Virtualization
By utilizing the igxForOf directive the IgxGrid now optimizes DOM rendering and memory consumption by rendering only what is currently visible in the view port and swapping the displayed data while the user scrolls the data horizontally/vertically. IgxGrid's width and height defaults to 100% which will enable virtualization if the content displayed cannot fit inside the available space and scrollbars are required either vertically or horizontally. However, it is also possible to explicitly set the Grid's width and/or height to null which means that the related dimension will be determined by the total size of the items inside. No scrollbar will then be shown and all items will be rendered along the respective dimension (columns if width is null and rows if height is null).
O tamanho dos blocos de dados é determinado por:
- The row height for the vertical (row) virtualization. This is determined by the
rowHeightoption and is 50(px) by default. - The individual column widths in pixels for the horizontal (column) virtualization. They can be determined by either setting explicit width for each column component or setting the Grid's
columnWidthoption, which will be applied to all columns that don't have explicit width set.
Na maioria dos casos, permitir que a grade aplique seu comportamento padrão deixando as dimensões não definidas produzirá o layout desejado. Para larguras de coluna, é determinado pela contagem de colunas, as colunas com largura definida e a largura calculada do contêiner da Grade. A grade tentará ajustar todas as colunas dentro do espaço disponível, desde que a largura que ela tenta atribuir não seja inferior a 136 (px). Nesses casos, as colunas com largura não atribuída receberão a largura mínima de 136 (px) e uma barra de rolagem horizontal será mostrada. A grade será virtualizada horizontalmente.
Definir explicitamente as larguras das colunas em porcentagens (%) criará, na maioria dos casos, uma grade que não é virtualizada horizontalmente, pois não terá uma barra de rolagem horizontal.
Remote Virtualization
The Grid supports remote virtualization, which is demonstrated in the Grid Remote Data Operations topic.
Virtualization Limitations
- No Mac OS, a barra de rolagem horizontal não é visível quando a opção do sistema "Mostrar barras de rolagem somente ao rolar" está definida como true (que é o valor padrão). Isso ocorre porque o contêiner de linha do Grid tem um estouro definido como oculto. Altere a opção para "Sempre" e a barra de rolagem aparecerá.
FAQ
Why having dimensions in the Grid is necessary for virtualization to work?
Sem informações sobre os tamanhos do contêiner e dos itens antes de renderizá-los, definir a largura ou a altura de uma barra de rolagem ou determinar quais dos itens devem estar no modo de exibição quando você rola para um local aleatório na Grade é errôneo. Quaisquer suposições sobre quais podem ser as dimensões reais podem levar a um comportamento não natural da barra de rolagem e, em última análise, a uma experiência abaixo do ideal para o usuário final. É por isso que a configuração das dimensões relacionadas é imposta para que a virtualização entre em vigor.
API References
- Componente IgxGridIgx
- Estilos IgxGridComponent
- IgxColumnComponent
- Diretiva IgxForOfDirective
- IForOfState
Additional Resources
- Visão geral da grade
- Paginação
- Filtragem
- Classificação
- Resumos
- Movimentação de Colunas
- Fixação de coluna
- Redimensionamento de colunas
- Escolha