Custom Download button plugin is firing twice (2 downloaded csv files)
Custom Download button plugin is firing twice (2 downloaded csv files)
Primalpat
Posts: 6Questions: 0Answers: 0
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.
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.
This discussion has been closed.
Replies
Allan
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