Adding new rows after selected row

Adding new rows after selected row

findpritzfindpritz Posts: 12Questions: 0Answers: 0
edited July 2010 in General
Hello,

I wanted to know how do I go about adding rows after a particular row in my datatable.

I can pass the row Index. that I need to insert the row to my javascript function, as follows:


function addNewContact(rCount){
iTable.fnAddData([
'',
'',
..

]);
}


And my HTML code is:





Also, to the newly added rows, I wanted the first 3 columns to not contain anything...How would I include this in the fnAddData() part ?

Thanks,
Pritish.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Ordering in DataTables is entirely done by 'sorting' - so there isn't really a concept of adding a TR after a different one. It will be placed after a TR that is defined by the sorting. So if you want a particular order, then you can take this into account by putting in the required data to get the ordering you want.

    > I wanted the first 3 columns to not contain anything...How would I include this in the fnAddData() part ?

    Just give the fnAddData array three empty strings for the first 3 columns.

    Allan
This discussion has been closed.