Hello, everyone.
I have a matrix field which widget type is 'Table with headers and multiple rows'.
When I try to create the node, javasript has an error message :

Uncaught TypeError: Cannot read property 'colSpan' of undefined.

I check the code and find the error because of the 115 to 117 line of tabledrag.js:

 var columnIndex = $('td', cell.parent()).index(cell.get(0)) + 1;
 var headerIndex = $('td:not(:hidden)', cell.parent()).index(cell.get(0)) + 1;
 $('tr', this.table).each(function(){

I guess it is because that matrix display a 'sub table' inside a simple table field and the index can not be calculated correctly.
For now I just add a code, with this my creating node could work.

var columnIndex = $('td:not(.matrix td)', cell.parent()).index(cell.get(0)) + 1;
var headerIndex = $('td:not(:hidden,.matrix td)', cell.parent()).index(cell.get(0)) + 1;
$('tr:not(.matrix tr)', this.table).each(function(){

Hope for a better solution to fix this bug because I think it's not a good way to modify a misc file directly.
Tks~

Comments

ydx’s picture

Title: 6.x-2.x-dev » Widget type 'Table with headers and multiple rows' has javasript error.
intrafusion’s picture

Status: Active » Closed (won't fix)
intrafusion’s picture

Issue summary: View changes

Miss one line to modify, else the column of table can not display correctly.

geekinpink’s picture

Issue summary: View changes

field collection having widget type table is not working for even records but it works well with odd records
plz help me out