Inline edit breaks when switching between tabs
Inline edit breaks when switching between tabs
![ztaylor1990](https://secure.gravatar.com/avatar/ba9bc8ad0613a3bce10898d4d8c53eae/?default=https%3A%2F%2Fvanillicon.com%2Fba9bc8ad0613a3bce10898d4d8c53eae_200.png&rating=g&size=120)
I am using datatables inline edit with tablinks. When I switch between tabs, from the default tab with the inline edit table to a new tab and then back to the default tab the editor stops working. In the console I get the following error. "Uncaught Cannot edit more than one field inline at a time". How can I fix this issue? I can not find any documentation online where someone is having the same issue.
I am creating and destroying the datatables like this on the onclick for my tabs. The tables reinitialize just fine, except the inline edit no longer works until I refresh the page.
rfpworking();$('#rfphistory').dataTable().fnDestroy();rfphistory();
Answers
Hi @ztaylor1990 ,
I suspect you would need to also
destroy()
the Editor instance when you recreate the tables. If that doesn't work, are you able to link to your page?Cheers,
Colin
My page requires a login and is on my companies server. This is my default tab where the inline edit is working.![](https://datatables.net/forums/uploads/editor/56/0eh6jhlbbx8m.png)
As soon as I switch tabs and then switch back to my default the inline edit no longer works and I receive this message. Uncaught Cannot edit more than one field inline at a time
I tried the destroy (editor.destroy();) but then I get the following error. Cannot read property 'destroy' of undefined
![](https://datatables.net/forums/uploads/editor/xh/qm65l4d0dysk.png)
I believe this is the part of the datatable that is not working correct?![](https://datatables.net/forums/uploads/editor/cy/n7qglr0f3kmd.png)
So I am not sure where I am supposed to destroy the editor and furthermore how do I reinitialize it?
It sounds like you're holding open an edit one switching tabs, but without seeing the problem, it's really shooting in the dark. I appreciate you can't give access to your site, but could you create a simplified test case (maybe based on this) that demonstrates the issue?
I found the problem when troubleshooting the live.datatable link with my project.
I had my function inside the inline edit call.
// Activate an inline edit on click of a table cell
$('#rfpworking').on( 'click', 'tbody td', function (e) {
editor.inline(rfpworking.cell( this ).index(), {
onBlur: 'submit',
I removed it and it works just fine now.
// Activate an inline edit on click of a table cell
$('#rfpworking').on( 'click', 'tbody td', function (e) {
editor.inline( this ).index(), {
onBlur: 'submit',
} ;
} );
Thanks
Correction to the above comment this is what fixed my issue..
// Activate an inline edit on click of a table cell
$('#rfpworking').on( 'click', 'tbody td', function (e) {
editor.inline(this), {
onBlur: 'submit',
} ;
} );