JSFiddle - React, Tailwind, and code Playground
HTML
var users_table;
var editor;
jQuery(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
"ajax": "/users/admin_update.json",
"table": "#users",
"idSrc": "id",
"fields": [ {
label: "Last name:",
name: "last_name"
}, {
label: "First name:",
name: "first_name"
}, {
label: "Email:",
name: "email"
}
]
} );
$('#users').on( 'click', 'tbody td', function (e) {
editor.inline( this, {
submitOnBlur: true
} );
} );
users_table = $('#users').DataTable({
"dom": "Tfrtip",
"searching": false,
"processing": true,
"serverSide": true,
"ajax": {"url": "/users.json",
"data": function(d){
d.user_search = $('#user_search').val()
}
},
"pagingType": "full_numbers",
"order": [[1,"asc"]],
"columns": [
{"data": "email", "type": "text"},
{"data": "last_name", "type": "text"},
{"data": "first_name", "type": "text"},
{"data": "lims", "type": "html"},
{"data": "groups", "type": "html","orderable": false}
],
"tableTools": {
sRowSelect: "os",
aButtons: [
{ sExtends: "editor_create", editor: editor },
{ sExtends: "editor_edit", editor: editor },
{ sExtends: "editor_remove", editor: editor }
]
}
});
});