check width of cells once table is loaded
check width of cells once table is loaded

I'm trying to measure the width of cells in fnDrawCallback .
docstable.DataTable().column(3).nodes().each(function (cell, i) {
console.log('$cell -----> ',cell);
}
the above code lets me know that i have located the correct cells
$(cell).addClass('test')
assures me that i am able to manipulate the DOM with this function
console.log('$cell -----> ',cell.offsetWidth);
returns a values of 0
i'm trying to find out which cells would be expanded beyond their default width. Those which would be are to have the css class added which contains overflow:ellipses. but without the measurements its impossible to do this calculation
Answers
It's returning
0
because those nodes aren't displayed, or been created - see example here. The first 10 have a width, as they're displayed, the rest are 0.Colin
is there a method, perhaps a callback, that would allow me to measure the width of cells as the appear on screen and then to reapply css rules based on these measurements?
The entire table, all columns, are adjusted as the rows get added depending upon the data the cells contain. You could check the first call to
createdRow
, which would give you widths for the very first row and then you could compare others against that.Colin