Is there any way to delay editing for the cell to which I click until the table reloading have not b
Is there any way to delay editing for the cell to which I click until the table reloading have not b
I am using server-side processing for dataTables with inline editing. Editor option onBlur is set to "submit". When I finish editing my cell, and then click to another editable cell. I will see two input controls. One,for the cell that have just been edited. Another, for the cell to which I have clicked.
Then both input controls are disappearing. First input is closed because of finishing onBlur event. Second input is disappeared because of table reloading. Sometimes I get the error "TypeError: node is undefined" in line 2754 of dataTables.editor.js. Is there any way to delay editing for the cell to which I click until the table reloading have not been done?
This question has an accepted answers - jump to answer
Answers
Hi,
The Javascript error might come about from passing the node to the
inline()
method - for example:That doesn't really work when using server-side processing because the table will redraw and destroy the old node. So you would want to pass in the cell index (
cell().index()
) - for example:where
table
is the DataTable API instance for the table.I think this should address both issues you are seeing. If not, are you able to give me a link to a test case showing the problem?
Thanks,
Allan
Thank you very much for your advise. I have changed
With
The error "TypeError: node is undefined" disappeared. It seems me everything fine with textboxes. But it is not help in case when I have "textbox" and "select" editors. I load options into "select" when the user clicks on cell and then I activate inline editing. The question is still opened. Could you check my sample here
Steps to reproduce:
You will see that both edit controls (textbox and select) are disappeared. The user should click on the cell twice to edit value in the second cell
Should be only one click to edit cell. Could you help me to solve it?
Hi,
Thanks for the details and the link - that was really instrumental in finding the issue. The issue is a bug in Editor I'm sorry to say, which is triggered when
onBlur:'submit'
andsubmit:'changed'
is used with inline editing and DataTables is in server-side processing mode.Basically the issue is that Editor is waiting for the DataTable to redraw, but that doesn't happen since nothing has been submitted if there are no changes!
I've committed the fix and it will be available in the next release, however, if you want to apply it immediately, its a fairly simple fix. Search the Editor Javascript file for:
and replace with:
Regards,
Allan
Hi Allan
I have tried to apply the fix immediately. I replaced
with
It seems me it takes no effect. The problem is reproduced. Could you please check my sample one more time?
Did you clear your browser's cache? It appears to work correctly for me now after I reloaded the file.
Regards,
Allan
Hi Allan
Yes of course, I have cleared my browser's cache
Thanks for the clarification.
It looks like there is a timing error here - a bit of a race condition which is why I didn't see it before, but I can see the issue just now and understand what the problem is.
Could you replace the entirely
Editor.prototype._tidy
method with the following please:I believe that will resolve the issue.
Thanks,
Allan
Hi Allan
"that" is undefined for submitComplete function
Sorry - I've updated the code above with the
var that = this;
statement moved as required.Allan
Hi Allan
Thank you for your update. I have replaced _tidy function and then I have cleared cache in all browsers.
It works better in Microsoft Edge and Chrome.
When I finish editing Description and then click on cell in Email column. I do not see two edit controls like it were before. But sometimes edit control is not shown after clicking on editable cell. Therefore the user should still click twice on cell to change the value in it. It seems me it works unstable.
I am observing the different situation in Firefox 43.0.2. When I finish editing Description and then click on cell in Email column. I always see two edit controls. Then both edit controls will be closed after the data reloading. The user should always click twice to edit value in Email column, if the value in description column have been previously changed.
So the problem left in Firefox 43.0.2
Sorry about this - I'm having trouble recreating the timing issue locally!
Could you try this which I believe will address the issue:
Thanks,
Allan
Hi Allan
Thank you for your update. I have replaced _tidy function and then I cleared cache in all browsers.
Firefox: I click on cell in Description column and change the value in it. Then I click on cell in same column but in the next row. I am expecting to see text area in the cell to which I have clicked. But It is not. I have to click on the cell one more time to edit the value in it.
Chrome: It works better than in other browsers. It almost perfect. But I have noticed the same problem that were described above for Firefox. The problem is reproduced rarely.
Edge: I found the same problem that were described above for Firefox. The problem is reproduced more often than in Chrome
Thanks for the update. One more change - I've just modified the code block above (the
if
condition on line 49 is the only thing to change) - could you possibly update your code to match.Many thanks,
Allan
Hi Allan.
Now it works fine.
Thank you
We got there in the end! Thanks for your forebarance with this issue. The fix will be in the 1.5.5 release of Editor which I expect to be available at the end of this month.
Allan