Skip to content

Commit d233399

Browse files
committed
[KNOWAGE-8605] add event listener to export button
1 parent d2c2cc6 commit d233399

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

knowage/src/main/webapp/WEB-INF/jsp/commons/preview.jsp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
8585
document.getElementById('utility-bar').classList.remove("hidden");
8686
document.getElementById('myGrid').classList.add("has-utility-bar");
8787
for(var e in options['exports']){
88-
document.getElementById('utility-bar').innerHTML += '<button class="kn-button" id="export-'+options['exports'][e].toUpperCase()+'" onclick="exportDataset(\''+options['exports'][e].toUpperCase()+'\')">Export '+options['exports'][e].toUpperCase()+'</button>'
88+
document.getElementById('utility-bar').innerHTML += '<button class="kn-button" id="export-'+options['exports'][e].toUpperCase()+'">Export '+options['exports'][e].toUpperCase()+'</button>'
8989
}
9090
exporterBarShown = true;
9191
}
@@ -394,7 +394,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
394394
DATASET = data.item[0];
395395
})
396396
}
397-
397+
398+
398399
function exportDataset(format){
399400
var body = {};
400401
Toastify({
@@ -439,6 +440,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
439440
})
440441
}
441442
443+
document.getElementsByClassName('kn-button').addEventListener('click', function(e){
444+
exportDataset(e.target.id.replace('export-',''));
445+
});
446+
442447
var eGridDiv = document.querySelector('#myGrid');
443448
new agGrid.Grid(eGridDiv, gridOptions);
444449

0 commit comments

Comments
 (0)