fnClose and server-side processing

fnClose and server-side processing

JpnhJpnh Posts: 2Questions: 0Answers: 0
edited April 2010 in Bug reports
Hi Allan,

using DataTables 1.6.2
This bug is related to the thread at http://datatables.net/forums/comments.php?DiscussionID=984&page=1

I have run into the issue in the thread myself and I want to share my findings with you. I am making a data table with server-side processing and want to expand/collapse rows that have content too big to fit on one line. The data for the expanded row is available client-side, so no server-request is done.

When debugging, I noticed the following in fnOpen:

[code]
/* No point in storing the row if using server-side processing since the nParent will be
* nuked on a re-draw anyway
*/
if ( !oSettings.oFeatures.bServerSide )
{
oSettings.aoOpenRows.push( {
"nTr": nNewRow,
"nParent": nTr
} );
}[/code]

fnClose searches aoOpenRows to find the row(s) it needs to close. But since I have server side processing enabled, the row never gets added to aoOpenRows. Since I open the row with client-side data, the nParent hasn't been nuked so when I call fnClose, the row doesn't close.

Removing the if wrapper works for me, and I don't see how not having it can hurt...

Thanks for the terrific plugin though!

Replies

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    Hi Jpnh,

    Thanks very much for posting this. I quite agree - having fnClose not coping with server-side processing was quite a poor idea of mine (funny how one looks back and goes "why on earth did I do that..."). I've just tried your modification and agree that it looks good. There is a small risk of the aoOpenRows array growing large, but I think it's worth the trade off. The change will be in 1.7.

    Regards,
    Allan
  • JpnhJpnh Posts: 2Questions: 0Answers: 0
    Glad I could help! Keep up the excellent work.
  • jnm99jnm99 Posts: 10Questions: 0Answers: 0
    The comment confusingly is still there though :)
  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    Heh good point jnm99. Thanks for that. The comment will be removed in the next release.

    Allan
This discussion has been closed.