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?


#2

Here you can find all the available methods that can be used with the “co”/“coro” exCell:
https://docs.dhtmlx.com/grid__managing_selectbox_collection.html
select box options should be added before adding the value to a cell.
Also, please, note that the cell with the select box should contain the value only that is listed in the options list.
If the problem still occurs for you please, provide a complete demo or a demo link, where the problem can be reproduced locally.