0

I am able to add child rows to an existing table dynamically after a specific row using following datatables api :

exampletable.fnOpen( nTr, formatExampleChange(oTable, nTr), 'detailsExpand' );

Now, I wanted to have the newly added row alignment along the lines of other existing rows having same column widths.

The browser (IE, Chrome) is calculating the table TH width and it is different in different pages. (even though th widths are mentioned using sWidth:px option on all columns)

I wanted to just add a new row with same column widths. Any ideas ? I am using data tables 1.9 version

I am thinking to use nTr.getChildNodes() and then get offset width or client width of existing row and then assign the same to the newly created row columns.

But, If there is any easy way, I would like to know.

Thank you, I appreciate any help. -Sri

1 Answer 1

1
var aoColWidths = [];

 for ( iColumn=0, iColumns=nTr.childNodes.length ; iColumn<iColumns ; iColumn++ ) {
    var colTd = nTr.childNodes[iColumn];
    aoColWidths.push( colTd.clientWidth );

 }

I have utilized above datatables api to get passed in row cols widths. and assigning these widths to newly created row cols.

Thanks!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.