/* Configuration Table */ configEditor = new $.fn.dataTable.Editor({ ajax: { create: '/Data/NewConfigurationData', edit: { type: 'PUT', url: '/Data/EditConfigurationData' }, remove: { type: 'DELETE', url: '/Data/DeleteConfigurationData', data: function (data) { return data.data; } } }, idSrc: 'id', table: "#configurationTable", fields: [{ label: "Part Group:", name: "name" }, { label: "RS Draw:", name: "rsdraw" }, { label: "RD Draw:", name: "rddraw" }, { label: "LAS Draw:", name: "lasdraw" }, { label: "LAA Draw:", name: "laadraw" }, { label: "Description:", name: "grpdes" }, { label: "ECR #:", name: "ecrnum" }, { label: "Rev Level:", name: "revlevel" }, { label: "Rev Date:", name: "revdate" }, { label: "Initials:", name: "revinit" }, { label: "Complete:", name: "complete" } ] }); // Activate an inline edit on click of a table cell $('#configurationTable').on('click', 'tbody td', function (e) { // Focus on the input in the cell that was clicked when Editor opens configEditor.one('open', () => { $('input', this).focus(); }); configEditor.inline(configTable.cells(this.parentNode, '*').nodes(), { submitTrigger: -2, submitHtml: '' }); }); // Delete row $('#configurationTable').on('click', 'tbody td.row-remove', function (e) { configEditor.remove(this.parentNode, { title: 'Delete record', message: 'Are you sure you wish to delete this record?', buttons: 'Delete' }); }); var configTable = $('#configurationTable').DataTable({ dom: "Bfrtp", ajax: { "type": "GET", "url": "/Data/GetConfigurationData", "contentType": "application/json; charset=utf-8", "dataType": "json" }, columns: [ { "data": 'name' }, { "data": 'rsdraw' }, { "data": 'rddraw' }, { "data": 'lasdraw' }, { "data": 'laadraw' }, { "data": 'grpdes' }, { "data": 'ecrnum' }, { "data": 'revlevel' }, { "data": 'revdate', "type": "datetime" }, { "data": 'revinit' }, { "data": 'complete' }, { data: null, defaultContent: '', className: 'row-edit dt-center', orderable: false }, { data: null, defaultContent: '', className: 'row-remove dt-center', orderable: false }, ], select: { style: 'os', selector: 'td:first-child' }, buttons: [{ extend: "createInline", text: "Create New Entry", editor: configEditor, formOptions: { submitTrigger: -2, submitHtml: '' } }] });