Custom Download button plugin is firing twice (2 downloaded csv files)

Custom Download button plugin is firing twice (2 downloaded csv files)

PrimalpatPrimalpat Posts: 6Questions: 0Answers: 0
edited December 2013 in TableTools
Hello all,

I am having an issue when using the example download plugin Allan mentioned here: http://datatables.net/forums/discussion/comment/28926

The first time I click it, everything works as expected. It downloads (or prompts to download in IE) the CSV. Afterwards, any event that is triggered relating to jquery (If I move the dialog box, resize, click on a different accordian, etc) will try to re-download the CSV.

Here are some images of what I am seeing in the Network Tab of Chrome's developer tools: http://imgur.com/a/9C1uO

It appears that the custom download button is adding an iframe to the body, and then the jquery library is somehow redrawing it? Forgive my lack of programming jargon, I am pretty new to the scene =)

Thanks for checking this out, and special thanks to Allan for this beast of a control.

Replies

  • allanallan Posts: 57,236Questions: 1Answers: 9,113 Site admin
    Can you link use to an example page showing the problem please?

    Allan
  • PrimalpatPrimalpat Posts: 6Questions: 0Answers: 0
    I PMed you the details to log into and view the datatables from our test site.
  • PrimalpatPrimalpat Posts: 6Questions: 0Answers: 0
    edited December 2013
    I am not sure what repercussions there will be for solving it in the manner I did but at least it works for now =)

    What I did:

    In the jquery lib file: jquery-1.10.1.js I marked out line 6088 which was:

    [code]
    before: function() {
    return this.domManip( arguments, function( elem ) {
    if (this.parentNode) {
    // Marked the below line out to fix the problem
    //this.parentNode.insertBefore( elem, this );
    }
    });
    },
    [/code]

    The full function can be found here: http://pastebin.com/zj1HVSZC
This discussion has been closed.