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

123
Visualizações
Exclusively assign value to common variable

Hi I have the following function,

private _setupTimeDayVal(days:any, times: any, data?: any){
        let timeData: Array<any> = [];
        for (let x in times){
            let timing: any = {};
            for (let y in days){
              if (days[y] == 'time'){
                  timing[days[y]] = (typeof days[y] != 'undefined') ?  times[x] : undefined;
                  timeData.push(timing);
                  this._rowResult = this._agSvc.setRowResult(timeData);
              }else {
                  this._rowResult = this._agSvc.setRowResult(data);
              }
            }
        }
        this._gridOptions.rowData = this._rowResult;
    }

The function takes in 3 parameters. Am checking whether one of the value in days array is time, it is one of the column in my table (ag-grid), then I create an object and push to empty array and assign it into a variable named _rowResult.

And at the end of the loop I assign the _rowResult value into my common variable named this._gridOptions.rowData which am used to pass as data into my table(ag-grid).

But its always passing me the else statement data(used to to add value to my other columns except the time column), this._rowResult = this._agSvc.setRowResult(data);.

But I want to improve this code so that my time column will be filled with the if statement data and other columns need to fill with the else statement. Any idea guys? Thanks in advance.

over 4 years ago · Santiago Trujillo
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