clientWidth reported incorrectly

clientWidth reported incorrectly

tobybowerstobybowers Posts: 1Questions: 0Answers: 0
edited October 2013 in DataTables 1.9
First of all sorry that I can't post a URL to an example but the pages are within a secure system.

The issue I am having is from the below code:

function drawFilters(oTable){
oThis = oTable.fnSettings();
console.log(oThis);
aoData = oThis.aoColumns;

$.map(aoData, function(value, index){
//get width of the column
console.log(oThis.aoColumns[index]);
col_width = oThis.aoColumns[index].nTh.clientWidth;
console.log(oThis.aoColumns[index].nTh.clientWidth);

The datatable auto generates column widths.
Each column does have a set sWidth of 100 but this is overridden by the autowidth.

I'll take index =0 as an example below.

in the response from the first console.log, navigating to aoColumns[0].nTh.clientWidth shows a value of 199. This is also the case when viewed from the second console log.

However, and this is the real kicker, when you check the value of col_width or the third console.log the sWidth value of 100 is returned not the correct clientWidth value of 199.

Another strange thing is that it does work correctly if you run the function within fnDrawCalback but I'm not able to maintain focus on the correct input field with that method.

Any ideas what might be happening or is this a bug in 1.9.4?
This discussion has been closed.