Inline editor plugin debugging

Inline editor plugin debugging

bsdzbsdz Posts: 17Questions: 6Answers: 0

Hi

I apologize in advance for not having a working demo of my problem. I'm using my froala editor plugin and haven't been able to replicate the issue using the tiny MCE one yet.

I have a datatable with inline editing and utilising the autosave functionality of the froala editor. The autosave has a timer that triggers a callback where I can either

1) use the froala editor built-in Ajax routines to update my server (and DB) with new text data, or

2) call the datatable's editor's submit() method

My problem is in

(1) after I change focus to a different cell, the datatable's cell data does not update. If I try and force it with by updating with cell().data() setter the editor form plugin closes.

(2) once the submit(null,null,null,false) is called the editor plugin form closes too.

I've tried various combinations of tweaking "owns", placing onBlur and onComplete handlers but the greatest difficulty is tracking down what actually triggers the "close" event on the plugin editor.

My question really is whether you can recommend where I can place JavaScript breakpoints to determine the close trigger and hence a workaround.

Again, sorry for not having a concrete example. I spent several hours on this yesterday and thought I'd reach out here now and hopefully cobble a working example together later this evening.

Thanks in advance
Blair

Answers

  • allanallan Posts: 61,946Questions: 1Answers: 10,158 Site admin

    after I change focus to a different cell, the datatable's cell data does not update

    Is the JSON being returned by the server in the format Editor expects? However ...

    once the submit(null,null,null,false) is called the editor plugin form closes too.

    I see - so you are basically looking for an auto save while the editing is still going on? That isn't something that Editor is really designed for I'm afraid, although I can see, now that you mention it, it could be useful. Editor is designed that once the edit is complete, it will redraw with the new data. You can stop it from closing its display, but it still thinks that the edit is complete and a new one would have to be started.

    What I think you'd probably need to do here is have a second Editor instance that will be used for the auto save. Have the interval timer run while editing, and then in the periodic callback, get the value of the text area (field().val() should do it) and feed that into the second Editor instance which you can submit to the server while the other one is still active.

    There are a couple of issues if you display two different Editors on the screen at the same time, but you should be able to have the second one completely hidden and thus I don't think you'll run into any problems that way.

    Allan

This discussion has been closed.