Я определил таблицу со следующим фрагментом кода.
<div class="gridheadercontainer">
<table class="table" cellspacing="0">
<colgroup>
<col style="width: 150px;">
<col style="width: 150px;">
<col style="width: 150px;">
<col style="width: 150px;">
<col style="width: 150px;">
</colgroup>
<thead>
<tr class="columnheader" style="cursor: pointer;">
<th class="headercell"><div class="headercelldiv">Task name</div></th>
<th class="headercell"><div class="headercelldiv">Start time</div></th>
<th class="headercell"><div class="headercelldiv">End time</div></th>
<th class="headercell"><div class="headercelldiv">Duration</div></th>
<th class="headercell"><div class="headercelldiv">Status</div></th>
<th class="headercell"><div class="headercelldiv"></div></th>
</tr>
</thead>
<tbody class="hide"><tr><td></td><td></td><td></td><td></td><td></td></tr></tbody>
</table>
</div>
В этом случае я использую следующий фрагмент кода, чтобы добавить col в colgroup таблицы.
$('.gridheadercontainer table colgroup').prepend(doc.createElement('col'));
Но он добавит столбец в 0-й индекс. Как выполнить команду col до последней таблицы colgroup
Вы имеете в виду append()
$('.gridheadercontainer table colgroup').append(doc.createElement('col'));