Adding a row in grid with a custom select box (coro)


#1

I have a custom select box (type coro) in my grid, which has different values in every row. How do I add a new row without a default value in the select box?

g_env.data.timesheet.data.forEach((row) => { 
  let data = [];
  g_env.tsFields.forEach((f) => { 
    if(f.match(/(job|project|account|task)/))
      data.push("");
    else 
      data.push(row[f]);
  });
  grid.addRow(row.id, data);
});

In the job, project, account, and task fields, there are read only select boxes that need to have specific values loaded by default. However, using cell.setValue() messes up the select box when no options have been added yet. I can push an empty string (""), but then there’s an empty string option in the select box even if I don’t use cell.put() once I am able to access the select box object.

How do I initialize the select box properly using addRow()? Is there a way to put the option list in the array or does it have to be done after the row is created?