Can I do this with inline edit ??
Can I do this with inline edit ??
I'm using datatables with bootstrap (jic) and looking at edit .. I had a table with two checkboxes on each row which when changed correctly updated server via ajax .. The code for this shown below and worked well ..
editor.edit($(this).closest('tr'), false)
.set('endOfDay', $(this).prop('checked') ? true : false)
.submit();
}).
on('change', 'input.editor-closed', function () {
editor.edit($(this).closest('tr'), false)
.set('closedSlot', $(this).prop('checked') ? true : false)
.submit();
})
I now have a new requirement where I want to allow inline editing of another field in the row and currently use submitOnBlur as shown ..
on( 'click', 'tbody td:not(:first-child)', function (e) {
editor.inline( this,{
submitOnBlur: true
} );
This correctly updates server via ajax but now it is possible to change checkboxes WITHOUT there content being transferred to the server unless the user leaves the cell .. I tried changing the checkboxes and replaced 'submit()' with 'blur()' but I couldn't get it to send changes to server.. Is it possible to do this with edit ? Also (supplementary question) , can I restrict which columns are editable in the datatable ? TIA ..
This question has an accepted answers - jump to answer
Answers
Yes. You already have with the selector used:
So
td
cells which are not the first child (i.e. the first column) are activating inline editing. If you want to exclude other columns the selector needs to be modified. One of the easiest options is to use thecolumns.className
option to assign a class (editable
for example) to the columns you want to be editable and then use:as the selector.
Allan
Thanks ! Have you any advice with my other problem (in the same question) relating to when updates are triggered ?
It's okay , this seems to have to have sorted my submission problem as well .. Thanks again