Core: Show console error for mismatched column count. See #1415

This commit is contained in:
Rob Garrison 2017-06-07 22:38:57 -05:00
parent 8dbd34ece6
commit 23c94a726d

View File

@ -2275,9 +2275,42 @@
} }
} }
} }
ts.checkColumnCount($rows, matrix, matrixrow.length);
return matrixrow.length; return matrixrow.length;
}, },
checkColumnCount : function($rows, matrix, columns) {
// this DOES NOT report any tbody column issues, except for the math and
// and column selector widgets
var i, len,
valid = true,
cells = [];
for ( i = 0; i < matrix.length; i++ ) {
// some matrix entries are undefined when testing the footer because
// it is using the rowIndex property
if ( matrix[i] ) {
len = matrix[i].length;
if ( matrix[i].length !== columns ) {
valid = false;
break;
}
}
}
if ( !valid ) {
$rows.each( function( indx, el ) {
var cell = el.parentElement.nodeName;
if ( cells.indexOf( cell ) ) {
cells.push( cell );
}
});
console.error(
'Invalid or incorrect number of columns in the ' +
cells.join( ' or ' ) + '; expected ' + columns +
', but found ' + len + ' columns'
);
}
},
// automatically add a colgroup with col elements set to a percentage width // automatically add a colgroup with col elements set to a percentage width
fixColumnWidth : function( table ) { fixColumnWidth : function( table ) {
table = $( table )[ 0 ]; table = $( table )[ 0 ];