Edit inline not working depeding on the action
Edit inline not working depeding on the action

Good afternoon everyone,
I don't know if anyone has ever experienced this problem.
My editor is configured for inline changes and is giving an error when changing lines after changes. For example, when I finish editing information in line ID 2, without pressing <enter> after the change, I click on another line to open information for editing, the editing field for this other ID opens and closes quickly, making it impossible to change the information in this new ID. Has anyone experienced this?
HTML
<script>
addEventListener("DOMContentLoaded", function () {
var editor = new DataTable.Editor( {
ajax: '/datatables--business-end-to-end-process-vs-process.php',
table: '#DT__List',
formOptions: {
main: {
focus: null,
submit: 'changed'
}
},
fields: [
{
"label": "ID__REL__Business__End_To_End_Process_X_Business__Process :",
"name": "REL__Business__End_To_End_Process_X_Business__Process.ID__REL__Business__End_To_End_Process_X_Business__Process",
"type": "readonly",
"attr": {
"disabled": true
}
},
{
"label": "ID__Project:",
"name": "Business__Area.ID__Project",
"type": "select",
"placeholder": "Select the project!",
"def": <?php echo $_SESSION["ID__Project"]; ?>,
"attr": {
"disabled": true
}
},
{
"label": "ID__Business__Area:",
"name": "Business__Process.ID__Business__Area",
"type": "select",
"placeholder": "Select the area!",
"attr": {
"disabled": true
}
},
{
"label": "ID__Business__Process:",
"name": "REL__Business__End_To_End_Process_X_Business__Process.ID__Business__Process",
"type": "select",
"placeholder": "Select the process!"
},
{
"label": "ID__Business__End_To_End_Process:",
"name": "REL__Business__End_To_End_Process_X_Business__Process.ID__Business__End_To_End_Process",
"type": "select",
"placeholder": "Select the end to end process!"
},
{
"label": "REL__Business__End_To_End_Process_X_Business__Process__Order:",
"name": "REL__Business__End_To_End_Process_X_Business__Process.REL__Business__End_To_End_Process_X_Business__Process__Order",
"type": "text",
"attr": {
"maxLength": 3
}
},
{
"label": "REL__Business__End_To_End_Process_X_Business__Process__Date:",
"name": "REL__Business__End_To_End_Process_X_Business__Process.REL__Business__End_To_End_Process_X_Business__Process__Date",
"type": "readonly",
"attr": {
"disabled": true
}
},
{
"label": "ID__Login:",
"name": "REL__Business__End_To_End_Process_X_Business__Process.ID__Login",
"type": "readonly",
"attr": {
"disabled": true
}
}
]
} );
var table = new DataTable('#DT__List', {
ajax: '/datatables--business-end-to-end-process-vs-process.php',
columns: [
{
"data": "REL__Business__End_To_End_Process_X_Business__Process.ID__REL__Business__End_To_End_Process_X_Business__Process"
},
{
"data": "Project.Project__Name",
"editField": "Business__Area.ID__Project"
},
{
"data": "Business__Area.Business__Area__Name",
"editField": "Business__Process.ID__Business__Area"
},
{
"data": "Business__Process.Business__Process__Name",
"editField": "REL__Business__End_To_End_Process_X_Business__Process.ID__Business__Process"
},
{
"data": "Business__End_To_End_Process.Business__End_To_End_Process__Name",
"editField": "REL__Business__End_To_End_Process_X_Business__Process.ID__Business__End_To_End_Process"
},
{
"data": "REL__Business__End_To_End_Process_X_Business__Process.REL__Business__End_To_End_Process_X_Business__Process__Order"
},
{
"data": "REL__Business__End_To_End_Process_X_Business__Process.REL__Business__End_To_End_Process_X_Business__Process__Date"
},
{
"data": "Login.Login__Name",
"editField": "REL__Business__End_To_End_Process_X_Business__Process.ID__Login"
},
{
data: null,
orderable: false,
"render": function (data, type, row, meta){
return '<a href="<?php echo $Str__User__Setup__Link_Painel; ?>consult-business-end-to-end-process-vs-process-backup/'+data.REL__Business__End_To_End_Process_X_Business__Process.ID__REL__Business__End_To_End_Process_X_Business__Process+'" target="_blank"><i class="btn btn-icon btn-sm bx bx-category"></i></a>';
}
}
],
colReorder: true,
fixedColumns: {
start: 1
},
fixedHeader: true,
layout: {
bottom: 'searchBuilder',
topStart: {
buttons: [
{
extend: 'create',
text: '<i class="fa fa-plus"></i> Add',
className: 'btn btn-outline-primary btn-wave',
editor: editor
}, {
extend: 'edit',
text: '<i class="fa fa-edit"></i> Edit',
className: 'btn btn-outline-primary btn-wave',
editor: editor
}, {
extend: 'remove',
text: '<i class="fa fa-trash"></i> Delete',
className: 'btn btn-outline-primary btn-wave',
editor: editor
}, {
extend: 'colvis',
text: '<i class="fa fa-search"></i> Columns',
className: 'btn btn-outline-primary btn-wave',
dropIcon: false,
editor: editor
}, {
extend: 'collection',
text: '<i class="fa fa-file-export"></i> Export',
className: 'btn btn-outline-primary btn-wave',
buttons: ['copy', 'excel', 'csv', 'pdf', 'print'],
dropIcon: false
}
]
}
},
order: [[0, 'desc']],
pageLength: 20,
paging: true,
scrollX: true,
scrollY: 550,
select: {
attr: {
className: 'selected-row'
},
selector: 'td:first-child'
}
});
// >>> LOAD
editor.on('submitSuccess', () => {
$('#DT__List').DataTable().ajax.reload();
});
// >>> UPDATE
table.on('click', 'tbody td:not(:first-child)', function (e) {
editor.inline(this, {
onBlur: 'submit',
submit: 'allIfChanged'
});
});
});
</script>
----------------------------------------------------------------------------------------------------
PHP
<?php
$Int__ID__Project = $_SESSION["ID__Project"];
include("DataTables/php/lib/DataTables.php");
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate,
DataTables\Editor\ValidateOptions;
Editor::inst($db, 'REL__Business__End_To_End_Process_X_Business__Process', 'ID__REL__Business__End_To_End_Process_X_Business__Process')
->fields(
Field::inst('REL__Business__End_To_End_Process_X_Business__Process.ID__REL__Business__End_To_End_Process_X_Business__Process')->set(false),
Field::inst('Project.Project__Name')
->set(false),
Field::inst('Business__Area.Business__Area__Name')
->set(false),
Field::inst('REL__Business__End_To_End_Process_X_Business__Process.ID__Business__Process')
->options(
Options::inst()
->table('Business__Process')
->value('ID__Business__Process')
->label('Business__Process__Name')
)
->validator(Validate::notEmpty(ValidateOptions::inst()
->message('Error: Fill the Process field!')
))
,
Field::inst('Business__Process.Business__Process__Name'),
Field::inst('REL__Business__End_To_End_Process_X_Business__Process.ID__Business__End_To_End_Process')
->options(
Options::inst()
->table('Business__End_To_End_Process')
->value('ID__Business__End_To_End_Process')
->label('Business__End_To_End_Process__Name')
)
->validator(Validate::notEmpty(ValidateOptions::inst()
->message('Error: Fill the End to End Process field!')
))
,
Field::inst('Business__End_To_End_Process.Business__End_To_End_Process__Name'),
Field::inst('REL__Business__End_To_End_Process_X_Business__Process.REL__Business__End_To_End_Process_X_Business__Process__Order'),
Field::inst('REL__Business__End_To_End_Process_X_Business__Process.REL__Business__End_To_End_Process_X_Business__Process__Date')->setValue(date("Y-m-d")),
Field::inst('REL__Business__End_To_End_Process_X_Business__Process.ID__Login')->setValue($_SESSION['ID__Login'])
->options(
Options::inst()
->table('Login')
->value('ID__Login')
->label('Login__Name')
)
->validator(Validate::notEmpty(ValidateOptions::inst()
->message('Error: Fill the Login field!')
))
,
Field::inst('Login.Login__Name')
)
->leftJoin('Business__End_To_End_Process', 'Business__End_To_End_Process.ID__Business__End_To_End_Process', '=', 'REL__Business__End_To_End_Process_X_Business__Process.ID__Business__End_To_End_Process')
->leftJoin('Business__Process', 'Business__Process.ID__Business__Process', '=', 'REL__Business__End_To_End_Process_X_Business__Process.ID__Business__Process')
->leftJoin('Business__Area', 'Business__Area.ID__Business__Area', '=', 'Business__Process.ID__Business__Area')
->leftJoin('Project', 'Project.ID__Project', '=', 'Business__Area.ID__Project')
->leftJoin('Login', 'Login.ID__Login', '=', 'REL__Business__End_To_End_Process_X_Business__Process.ID__Login')
->where(function($q) use ($Int__ID__Project){
if($Int__ID__Project<>0){
$q->where('Business__Area.ID__Project', $Int__ID__Project);
}else{
$q->where('Business__Area.ID__Project', $Int__ID__Project, '>');
}
})
->process($_POST)
->json();
<?php
>
?>
It's not possible showing a video, but I can give the rights to access if needed, it's a test environment.
Answers
Hi,
Yes please, if you can PM me access details, that would be really useful. I've just tried to recreate the issue in this example but it appears to work as expected.
Allan