Datatables + fancybox - Reload on specific conditons?

Datatables + fancybox - Reload on specific conditons?

dittoditto Posts: 6Questions: 0Answers: 0
edited March 2011 in General
I am loading data into datatables from a DB via AJAX. There are bunch of columns and it's not possible to view them all at the same time in any sane way. So In one of my columns I have a link that opens an iframe (with tabbed content) to view or edit the full record. For that I'm using fancybox. What I'd like to do is have datatables reload *only* if I update the record (hit an update button in the iframe). Via the fancybox onclose function I was able to cause a reload everytime the iframe is closed but I don't see a way to pass a variable to it to say only refresh if update=true. Maybe I can do something on the datatables side?

Before I went off and spent a lot of time lot of time researching this and trying to figure it out on my own I was wondering if anyone might have some ideas to point me in th right direction and help save me some time?

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Sounds reasonable - are you planning on reloading the whole table (i.e. the fnReloadAjax plug-in) or just a given row (i.e. the fnUpdate API method)? Either way, can you just put an 'if' condition around the reload to check if it should be done or not?

    Allan
  • dittoditto Posts: 6Questions: 0Answers: 0
    Ah.. fantastic!

    fnReloadAjax was exactly what I needed. I created a function to call from an onsubmit on my iframe that closes francybox then calls it. Super fast! Much better than reloading the whole page.

    Thanks for the help. I love datatables.
This discussion has been closed.