How to rebind after fnReloadAjax?

How to rebind after fnReloadAjax?

dadodado Posts: 17Questions: 0Answers: 0
edited September 2009 in General
Hello Allan,

first i'd like to thank you for this nice piece of software. :-)
I'm rather new to Javascript so it is possible that my question is not REALLY clever. ;-)

I've a table with round about 15.000 rows. Too much for clientbased processing only. so i switched to fnReloadAjax. I insert an additional selection menu and get 200-600 rows for each selection made in my resulttable. This can be filtered by an integrated submenu in the selection menu.

Now the response times are really good. :-)

Then i got the first problem that i couldn't solve without your and yours forum help. The binding (click handler to mark/unmark a row) that i made on each row in tbody are lost when fnReloadAjax is called. Read the forum and found fnDrawCallback.
But when i filter the rows it seems to bind twice. One click get 2 debug alerts in the function.

I think the best way is to rebind the clickhandler after every fnReloadAjax, but i don't get the point. :-(

Can you please help me?

Thanks
Daniel

My table at the beginning
[code]

Replies

  • allanallan Posts: 61,840Questions: 1Answers: 10,134 Site admin
    Hi dado,

    Assuming you are using fnReloadAjax from here ( http://datatables.net/plug-ins/api#fnReloadAjax ), then there is a third parameter which you can (optionally) pass, which is a function that will be called when the table has been reloaded. You can just add your event handler addition into the function passed in there :-)

    Regards,
    Allan
  • dadodado Posts: 17Questions: 0Answers: 0
    ahhhhhhh,

    it's not _that_ easy, isn't it?
    Thanks for the quick response.
    Works like a charm. :-)

    Regards
    Daniel
This discussion has been closed.