pagination/input.js plugin with Editor and inline edits - difficult to get focus into Page Input box
pagination/input.js plugin with Editor and inline edits - difficult to get focus into Page Input box
I recently started using the input.js plugin along with DataTables and Editor to be able to jump to a page easily. It works great for the most part. However, I noticed when editing a cell, if before you hit enter, you click into the Page input box, the input box never gets focus, but the focus is still active in the cell you were just editing. But, if you first click out of the table (e.g. click the DT Search box) or anywhere outside the table, it first saves your cell value and then you can successfully enter a value in the Page input box.
I think it is more a by-product of the inline editing & save on blur/enter than anything else. Just curious if anyone else has noticed this behavior and if there is a way to avoid it (short of having users first click outside the table, and then click into the Page input box).
(I am using all the latest libraries including KeyTable 2.5.0-dev)
dtTable = $("#EditorTable").DataTable({
data: itemsJson,
scrollX: "100%",
scrollY: 650,
lengthMenu: [30, 50, 100],
pageLength: 100,
scrollCollapse: true,
order: [[1, 'asc']],
orderClasses: true,
stateSave: true,
stateDuration: 0,
pagingType: 'input',
keys: {
columns: [ 1,4,6,7,8,9,10,11,12,13,14,15,16 ],
editor: dtEditor,
editOnFocus: true,
drawType: 'page'
}
});
// Activate an inline edit on click of a table cell
$('#EditorTable').on( 'click', '.table-cell-edit', function (e) {
dtEditor.inline(this, {
onBlur: 'submit',
drawType: 'page'
});
This question has an accepted answers - jump to answer
Answers
Interesting - thats not one I've come across before. I'm planning to rewrite the input paging type sometime soon as its a bit of a mess at the moment and the plug-in system offers a lot more since it was originally developed.
There must be a
preventDefault
orstopPropagation
somewhere in the input plugin that is causing this issue.Allan
That would be great, thanks.
There was an example on your site that actually had the odd behavior I'm describing, but I can't find it anymore.
If you manage to find it, please do let me know!
Allan