JoshuaBoshi
JoshuaBoshi

Reputation: 1286

dijit.Editor's cleared after re-append

I have problem with dijit.Editor. After removing it's DOM from document and re-appending it, it's value is cleared.

The test for this is in this fiddle: According to commented alerts in example, the value is being cleared after appending. It is still in memory after removing editor.

I tried to add "reloading" code to onLoadDeferred. But it is not called when reappending editor.

I cannot easily call reload on it by myself, because I am re-appending whole form in my app. I don't know anything about form's contents.

Also, I am quite sure that this is dijit.Editor's issue. I tested reappending javascript generated Iframe (example here) and it is working.

Thanks for any help!

Upvotes: 0

Views: 118

Answers (1)

phusick
phusick

Reputation: 7352

I modified your iframe javascript test so it writes to iframe document only once and it seems to behave the same way the Dijit Editor does.

I think you will have to set value of the Editor every time you placeAt it, but you do not have to do it manually, you can use one of these:

  1. dojo/aspect:

    aspect.after(editor, "placeAt", lang.hitch(editor, function() {
        this.set("value", this.get("value"));
    }));
    
  2. dojo/declare:

    var Editor = declare([DijitEditor], {
        placeAt: function() {
            this.inherited(arguments);
            this.set("value", this.get("value"));
        }
    });
    

See it in action at jsFiddle: http://jsfiddle.net/phusick/PXZk5/

Upvotes: 1

Related Questions