Add a row at the first position.

Add a row at the first position.

JoachimJoachim Posts: 1Questions: 0Answers: 0
edited May 2012 in General
Hi,

I would like to create a new row in my table, so I used the function fnAddData, but I can't realise to insert it at the first position.

This is my javascript'code :

[code]
var oTable = $("#tableau_5_0").dataTable( {
"sPaginationType": "full_numbers",
"aoColumns": [null, null, null, { "bSortable": false } ],
"fnDrawCallback": function ( oSettings ) {
if ( oSettings.aiDisplay.length == 0 )
{
return;
}

var nTrs = $('tbody tr', oSettings.nTable);
var nGroup = document.createElement( 'tr' );
nGroup.setAttribute("id","new_row_5_0");
nGroup.innerHTML = contenuAjoutLigne5_0; // this is a row inserted after the header to add dynamicly rows
nTrs[0].parentNode.insertBefore( nGroup, nTrs[0] );
}
});
[/code]

So If someone got a solution, that's was realy cool !!! Thanks
This discussion has been closed.