DOJO: add content area items to the empty content area


Hi All,

I made a function for copying content area items from one content area to another. Everything work great except for the one case: when the target content area is empty. The items are copied but the editor view is not updated as usual. If there are any items in the target content area thene the editor view is updated. In this case when the target content area is empty, I have to switch views or reload/refresh the whole page and than the chages are visible.

Here is the function:

_copyContentAreaItems: function (sourceContentArea, targetContentArea) {
                var emptyCa = false;
                if (!targetContentArea.model.count) {
                    //targetContentArea.model.count = 0;
                    emptyCa = true;
                for (let c14 = 0; c14 < sourceContentArea.model.count; c14++) {
                    dojo.when(sourceContentArea.model.getChildByIndex(c14), lang.hitch(this, function (contentData) {
                        targetContentArea.model.modify(lang.hitch(this, function () {                            

                        console.log("ContentArea copy from " + + " to " +, contentData);
                console.log("ContentArea copy target[" + + "] count: " + targetContentArea.model.count);


Just to point out that this function is in the custom editor for the property that is not a content area.

Does anybody knows how to initialize that empty content area before adding items? 

Any ideas are welcome :)

Jul 24, 2019 17:59
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.