JSFiddle - React, Tailwind, and code Playground
JavaScript
define([
'jscore/core',
'jscore/ext/utils',
'jscore/ext/privateStore',
'tablelib/Table',
'../Plugin',
], function (core, coreUtils, PrivateStore, Table, Plugin) {
'use strict';
var _ = PrivateStore.create();
return Plugin.extend({
name: 'ExportTable',
priority: 4,
injections: {
after: {
onTableReady: onTableReady,
onDestroy: onDestroy
},
newMethods: {
enableExport : enableExport,
disableExport : disableExport,
}
}
});
function onTableReady() {
/* jshint validthis:true */
var table = this.getTable();
this.exportType = this.options.type.toString().toLowerCase();
this.filename = this.options.name;
if(this.options.hasOwnProperty('element')){
this.element = this.options.element.element;
this.separator = this.options.element.separator;
}
addExport.call(this);
addExportEventHandler.call(this);
}
function onDestroy() {
/* jshint validthis:true */
if(_(this).exportPlugin !== undefined){
getExport.call(this).remove();
if(this.element){
this.element.remove();
}
if(this.separator){
this.separator.remove();
}
// _(this).exportPlugin.call(this).destroy();
}
}
function enableExport(){
// if(_(this).exportPlugin !== undefined){
_(this).exportPlugin.removeStyle('pointer-events','none');
_(this).exportPlugin.find('.ebIcon').removeModifier('disabled','ebIcon');
_(this).exportPlugin.find('.ebIcon').setModifier('interactive','','ebIcon');
// }else{
// console.log('ERROR!');
// }
}
function disableExport(){
if(_(this).exportPlugin !== undefined){
...