Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

121
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!