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

85
Visualizações
ag-grid data dependent on httprequest sometimes does not load the table

I'm trying to use a currency converter api and use its conversion data into my ag-grid table. The problem is when I load my page, sometimes the ag-grid table is loaded while sometimes it is not. There are occasions where I have to refresh the page multiple times to get the table to appear. If I run it on my local, I'm not encountering the problem.

Here's what I have so far:

function fxc(callback) {
    var requestURL = 'https://api.exchangerate.host/latest?base=EUR';
    var httpRequest = new XMLHttpRequest();
    httpRequest.onload = function(){ 
       callback(httpRequest.response);
    };
    httpRequest.open('GET', requestURL);
    httpRequest.send();
}

fxc(function(result) {
   const xxhr = JSON.parse(result)
   var usdrate = 1/xxhr.rates.USD
   ***ag-grid functions/codes using usdrate**
});

AG-GRID section has an addEventListener so it feels like its conflicting with the onload = function

document.addEventListener('DOMContentLoaded', function() {
    var gridDiv = document.querySelector('#myGrid');
    new agGrid.Grid(gridDiv, gridOptions);

    agGrid
        .simpleHttpRequest({
            url: 'csvjson.json',
        })
        .then(function(data) {
            gridOptions.api.setRowData(data);

            autoSizeAll(false);
        });
});
about 4 years ago · Juan Pablo Isaza
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