Skip to content

Commit

Permalink
allowing edit of download filename
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasalmeida committed Oct 23, 2014
1 parent b684352 commit 7b08026
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions openHealth.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,20 +437,25 @@ this.crossdoc2html=function(d,title){ // create table from cross-document
var div = document.createElement('div');
div.innerHTML=html;
var bt = document.createElement('input');
bt.type = "button";
bt.value = "download"
bt.type = "button";bt.value = "Download";bt.style.backgroundColor="yellow";bt.style.color="blue";
var sp = document.createElement('span');sp.textContent=' as CSV with filename: ';sp.style.color="navy";
var ipTitle = document.createElement('input');ipTitle.size=100;ipTitle.style.color="blue";ipTitle.value=title;
//lala = bt;
bt.d=d;// the data
bt.onclick=function(){
openHealth.saveFile(openHealth.crossdoc2csv(this.d,title),title)
var title = this.parentElement.childNodes[3].value;
openHealth.saveFile(openHealth.crossdoc2csv(this.d,title),title);
//console.log(this)
}
div.appendChild(bt)
return div;
div.appendChild(bt);
div.appendChild(sp);
div.appendChild(ipTitle);
return div;
}




this.markdown=function(x){ // basic markdown2html
x = x.replace(/\[([^\]]+)\]\(([^\)]+)\)/g,'<a href="$2" target=_blank>$1</a>'); // links
x = x.replace(/\n/g,'<br>'); // new lines
Expand Down

0 comments on commit 7b08026

Please sign in to comment.