JSFiddle - React, Tailwind, and code Playground
by Dmitri Ganenco
JavaScript
(function() {
'use strict';
function UsersHelper(){
this.init();
this.usersTable = null;
}
UsersHelper.prototype.init = function(){
$('#userType').on('change', function(){
let newData = [{ 'name': 'foo' }];
this.usersTable.row.add(newData);
}.bind(this));
this.initUserTable();
};
UsersHelper.prototype.initUserTable = function(){
this.usersTable = $('#my-dataTable').DataTable({
columns: [{
data: 'name'
}],
destroy: true,
});
$('#userType').trigger('change');
};
});