JSFiddle - React, Tailwind, and code Playground
JavaScript
var $ = require('jquery')
require('datatables.net-bs')
require('./dataTables.editor.js')(window, $)
const editor = new $.fn.dataTable.Editor({
ajax: '/api/staff',
table: '#example',
fields: [
{ label: 'First name', name: 'first_name' },
{ label: 'Last name', name: 'last_name' },
// etc
]
} );
$(() => {
setAPIOrigin(location, config)
// Instantiate a new User in store.
store.user = new User(false)
// Insert application heading (done after the basic DOM loads to avoid
// jumping around on the screen at page load.
$('#app-title').html('<h1>Achieve Your Bucket List</h1>')
// Load initial page content: matrix form & login/register buttons
authnDispatchUI.initUI()
// other UI inits go here
$('#example').DataTable( {
ajax: '/api/staff',
dom: 'Bfrtip',
columns: [
{ data: 'first_name' },
{ data: 'last_name' },
// etc
],
select: true,
buttons: [
{ extend: 'create', editor: editor },
{ extend: 'edit', editor: editor },
{ extend: 'remove', editor: editor }
]
} );
})