autofill rows

autofill rows

chester_cheetoschester_cheetos Posts: 1Questions: 0Answers: 0
edited November 2009 in General
Hello,

I have a result with 23 rows and my iDisplayLength = 10;
Now I want to show always 10 rows. So when the last page returns 3 rows
i want to add 7 empty rows.

Is this possible?

Replies

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    Hi chester_cheetos,

    There isn't actually a method implemented in DataTables which does this automatically for you, but it certainly is possible to quickly add it in. What to do is make use of fnDrawCallback(), and check to see if your table has the required number of TR elements in it ( nTable.getElementsByTagName("tr") == 10, etc ) and if not, simply create and append the nodes required. This way they are temporary nodes which DataTables knows nothing about but will achieve exactly what you are looking for.

    Regards,
    Allan
This discussion has been closed.