Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

122
Visualizações
Access the page size in a Material UI `<DataGrid autoPageSize/>`

By using <DataGrid autoPageSize/>, as described in the docs, you can get a Material UI table that automatically sets the page size (ie the number of rows per page) based on the browser height. However, if you are progressively loading data from the server, you need to know what that page size is, in order to know how much data to load per page, and which row the table is up to. As far as I can tell, the DataGrid only gives you access to the page number (through various events) which doesn't let you determine the page size.

The component does give you access to a pageSizeChange event, but this doesn't actually fire when the component automatically sets its page size using autoPageSize, so it doesn't help here.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I also ran into the same issue of trying to use DataGrid with server-side pagination. After some digging around, I found that I'm able to see that onPageSizeChange is triggered when the component first loads. See this codesandbox.

If you look at the console after refreshing the codesandbox browser, it prints 0, then 5. You could save this into state and then use it in your onPageChange calls.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda