inline edit submit more than one field of the form
inline edit submit more than one field of the form
Andreas S.
Posts: 208Questions: 74Answers: 4
in Editor
I have one column in the datatable that can be inline edited. My problem is, to save this change i need more data. These data are exist in the datatable. I have defined these fields in the editor form, but only the the action and the edited field are post to the server.
What should i do, that onBlur, are send all form data fields?
Here my code:
eInline = new $.fn.dataTable.Editor( {
ajax: ajaxurl + '&single=3',
table: '#structuretbl',
fields: [
{
label: 'entryTime',
name: 'entryTime',
},{
label: 'entry',
name: 'entry',
type: 'checkbox',
seperator: '|',
options: [
{ label: 'no', value: 0 },
{ label: 'yes', value: 1 }
]
},{
label: 'e_uuid',
name: 'e_uuid',
},{
label: 'entryUuid',
name: 'entryUuid',
},{
label: 'scmbesttime',
name: 'bestTime.SCM.swtime'
},{
label: 'lcmbesttime',
name: 'bestTime.LCM.swtime'
},{
label: 'click',
name: 'clicked'
}
],
formOptions: {
inline: {
onBlur: 'submit',
onEsc: 'submit'
}
}
} );
var structure = $( '#structuretbl' ).DataTable( {
language: {
url: i18n_url
},.....
$( '#structuretbl' ).on( 'click', 'tbody td.edittime', function( e ) {
eInline
.inline( this );
} );
Andreas
This discussion has been closed.
Answers
this link shows the default form options for inline editing:
https://editor.datatables.net/reference/option/formOptions.inline
The default for "submit" is "changed". Only the changed fields are submitted.
this link has the default form options for "normal" editing:
https://editor.datatables.net/reference/option/formOptions.main
The default for "submit" is "all".
If you want the same behavior for inline editing you would need to change the submit option for inline editing like in here:
https://editor.datatables.net/reference/type/form-options#submit---What-values-should-be-submitted-to-the-server
Hi @Andreas S. ,
It might be better to do it in the
preSubmit
- the example on that page is doing something similar.Cheers,
Colin